原文是在这里的: http://dmitry.baranovskiy.com/post/91403200
Quick test for real understanding of JavaScript core beyond closures and scopes. Here five small scripts. Try to answer what will be alerted in each case without running them in the console. Then you could create a test file and easily check your answers. Ready?
<b>if</b> (!(<i>"a"</i> <b>in</b> window)) { <b>var</b> a<span class="s"> = </span><span class="d">1</span>;}alert(a);
<b>var</b> a<span class="s"> = </span><span class="d">1</span>, b<span class="s"> = </span><b>function</b> a(x) { x && a(--x); };alert(a);
<b>function</b> a(x) { <b>return</b> x<span class="s"> * </span><span class="d">2</span>;}<b>var</b> a;alert(a);
<b>function</b> b(x, y, a) { arguments[<span class="d">2</span>]<span class="s"> = </span><span class="d">10</span>; alert(a);}b(<span class="d">1</span>, <span class="d">2</span>, <span class="d">3</span>);
<b>function</b> a() { alert(<b>this</b>);}a.call(<b>null</b>);<br><br>
Original: https://www.cnblogs.com/amboyna/archive/2010/01/26/1656800.html
Author: 玉米疯收
Title: So, you think you know JavaScript? (你认为你懂JS吗)
原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/536197/
转载文章受原作者版权保护。转载请注明原作者出处!