title: Break out from a switch with a delay: setTimeout + break = syntax error
body: <p>I'm trying to make some animation relying on the CSS transitions, adding and removing classes: (now some code, then some further explanation)</p>
  
  <pre><code>/*variables are defined outside this function*/
  function effect() {
      switch(activeWall.attr("animation-order")) {
          case "incremental":
              if(!j) { /*if first box*/
                  boxes.eq(j).addClass("hovered");
                  ++j;
                  break;
              };
  
              if (j == defaultOrder.lenght) { /*if last box*/
                  boxes.eq(j).removeClass("hovered");
                  setTimeout(break, 1000); /*syntax error*/
              };
  
              /*any other*/
              boxes.eq(j).addClass("hovered");
              boxes.eq(j-1).removeClass("hovered");
              ++j;
              break;
  
          default:
              if(!i) { /*if first box*/
                  boxes.eq(defaultOrder[i]).addClass("hovered");
                  ++i;
                  break;
              };
  
              if (i == defaultOrder.lenght) { /*if last box*/
                  boxes.eq(defaultOrder[i]).removeClass("hovered");
                  setTimeout(break, 1000); /*syntax error*/
              };
  
              /*any other*/
              boxes.eq(defaultOrder[i]).addClass("hovered");
              boxes.eq(defaultOrder[i-1]).removeClass("hovered");
              ++i;
              break;
      };
  };
  </code></pre>
  
  <p>The transition in <code>hovered</code> class for the user to see it in case of the last box, before something else happening, I need to wait before exiting the <code>switch</code> with a <code>break</code>. Putting a delay like this <code>boxes.eq(i).removeClass("hovered").delay(n)</code> after removing the class would be ineffective because the next jQuery animations are applied on others elements.
  I thought putting the <code>break</code> with a <code>setTimeout</code> would do, but I get a syntax error.</p>
  
  <p>So, how I can pause the flow of the script for the time necessary to the transition to be effective? Am I using <code>setTimeout</code> badly?</p>