JavaScript/作用域:修订间差异
来自康健生活
创建页面,内容为“== 引言 == == 示例 == {{leftrightflex|<syntaxhighlight lang="javascript"> var foo = function() { var local = {}; }; foo(); </syntaxhighlight>|{{consoleout|<pr…” |
|||
| 第7行: | 第7行: | ||
}; | }; | ||
foo(); | foo(); | ||
console.log(local); | |||
</syntaxhighlight>|{{consoleout|<pre> | </syntaxhighlight>|{{consoleout|<pre> | ||
undefined</pre>}}}} | undefined</pre>}}}} | ||
| 第15行: | 第16行: | ||
}; | }; | ||
foo(); | foo(); | ||
console.log(local); | |||
</syntaxhighlight>|{{consoleout|<pre> | </syntaxhighlight>|{{consoleout|<pre> | ||
{}</pre>}}}} | {}</pre>}}}} | ||