title: Check syntax of JavaScript(jQuery) code before running jQuery.globalEval() or eval()
body: <p>Continuing with topic: <a href="https://stackoverflow.com/questions/7921851/jquery-globaleval-function">jQuery .globalEval() function</a></p>
  
  <p>I use jQuery.globalEval(varwithJScode);</p>
  
  <p>Now the problem starts when code in varwithJScode contains syntax or other error - the whole script stops.</p>
  
  <p>jsFiddle does not support jQuery.globalEval(), but I used eval() instead to simulate.</p>
  
  <p><a href="http://jsfiddle.net/55FfW/" rel="nofollow noreferrer">http://jsfiddle.net/55FfW/</a>
  Try changing var codeforeval to some wrong javascript code and next command will fail.</p>
  
  <p>Is there a way to avoid other JS code from stopping in case of error and/or is there a way to check syntax before eval?</p>
  
  <p>Tried using this one:</p>
  
  <pre><code>try {
     jQuery.globalEval(jscode);
  } catch (e) {
     if (e instanceof SyntaxError) {
        alert('JS error!');
     }
  }
  </code></pre>
  
  <p>Does not work for me!</p>