title: jquery Uncaught SyntaxError: Illegal break statement
body: <blockquote>
    <p>Uncaught SyntaxError: Illegal break statement</p>
  </blockquote>
  
  <p>This is the warning i got when i try to break of the loop. What I want to do break of the loop when the condition is meet.In the example code I have two active class where I want to break out of the loop completely when the first active class is encountered.</p>
  
  <pre><code>&lt;ul&gt;
      &lt;li id="foo1" class="bar"&gt;1&lt;/li&gt;
      &lt;li id="foo2" class="bar"&gt;2&lt;/li&gt;
      &lt;li id="foo3" class="bar"&gt;3&lt;/li&gt;
      &lt;li id="foo4" class="bar"&gt;4&lt;/li&gt;
      &lt;li id="foo5" class="active"&gt;5&lt;/li&gt;
      &lt;li id="foo6" class="bar"&gt;6&lt;/li&gt;
      &lt;li id="foo7" class="bar"&gt;7&lt;/li&gt;
      &lt;li id="foo8" class="active"&gt;8&lt;/li&gt;
  &lt;/ul&gt;
  </code></pre>
  
  <p>js</p>
  
  <pre><code>$(function(){
      function setup(){
          var x,y,z;
           $("ul li").each(function(){
               //console.log($(this)[0].className);
               if($(this)[0].className === 'active'){
                   x = $(this)[0].className;
                   y = $(this)[0].tagName;
                   z = $(this)[0].id;
                   break;
               } 
           });
          var return_values = {
              class : x,
              tag : y,
              id : z
          }
          return(return_values);
      }
      var data = setup();
      console.log(data.class,data.tag,data.id);
  });
  </code></pre>
  
  <p>JSFIDDLE <a href="https://jsfiddle.net/5avxmeto/" rel="noreferrer">here</a></p>