Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You can simply use the <code>return;</code> example </p> <pre><code>$(document).ready(function () { alert(1); return; alert(2); alert(3); alert(4); }); </code></pre> <p>The return will return to the main caller function test1(); and continue from there to test3();</p> <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en"&gt; &lt;head&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /&gt; &lt;/head&gt; &lt;body&gt; &lt;script type="text/javascript"&gt; function test1(){ test2(); test3(); } function test2(){ alert(2); return; test4(); test5(); } function test3(){ alert(3); } function test4(){ alert(4); } function test5(){ alert(5); } test1(); &lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>but if you just add throw ''; this will completely stop the execution without causing any errors.</p> <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en"&gt; &lt;head&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /&gt; &lt;/head&gt; &lt;body&gt; &lt;script type="text/javascript"&gt; function test1(){ test2(); test3(); } function test2(){ alert(2); throw ''; test4(); test5(); } function test3(){ alert(3); } function test4(){ alert(4); } function test5(){ alert(5); } test1(); &lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>This is tested with firefox and chrome. I don't know how this is handled by IE or Safari </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload