title: Inline jQuery unexpected token switch
body: <p>Stumped as to why this simple code keeps giving me a </p>
  
  <blockquote>
    <p>Uncaught SyntaxError: Unexpected token switch</p>
  </blockquote>
  
  <pre><code>&lt;script&gt;
      $(document).ready(function() {
          setInterval('switch()', 5000);
      });
  
      function switch(){
          var $active = $('#placeholder img.active');
          var $next = $active.next();
  
          $next.addClass('active');
          $active.removeClass('active');
      }
  &lt;/script&gt;
  </code></pre>
  
  <p>I thought functions can be outside the <code>document.ready</code> function? When I tried putting <code>switch()</code> inside the <code>.ready</code> function, it gave me the same error. My jsfiddle: <a href="https://jsfiddle.net/kL1Lrb2z/1/" rel="nofollow">https://jsfiddle.net/kL1Lrb2z/1/</a></p>