Question: I have a list if `<span>` elements, which I need to filter and apply multiple operations (text replacement and add a class conditionally). I have the following working code:

```
$('span').filter(function() {
     return $(this).text().toLowerCase()==phrase;
}).text(translation);

$('span').filter(function() { 
     return $(this).hasClass('translatable') && $(this).text().toLowerCase()==phrase;
}).addClass(translated);

```

This works, but is clearly going through all the `<span>`s twice. Is it possible to combine them into one iteration, something on the lines of:

```
$('span').filter(function() { 
     return $(this).text().toLowerCase()==phrase;
}).function() {
     $(this).text(translation);
     if($(this).hasClass('translatable'))
         this.addClass("translated")
}

```

Answer: 
Labels are local, so you can use the same label in multiple functions.

The question about if you should use `goto` is a different matter though, and one that is not easily answered. In short, don't use `goto`. But as with everything (especially when it comes to programming) there are exceptions where `goto` may be useful.
As Joachim said here, labels are local; but note that labels are local to functions - not to the current block. `goto` statements do not respect scoping, except for whole-function scoping.