We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
var name = 'Tom'; (() => { if (typeof name === 'undefined') { var name = 'jeck'; console.log('1:', name); } else { console.log('2:', name); } })() // 结果输出 “1: jeck”
var name = 'Tom'; (() => { var name; if (typeof name === 'undefined') { name = 'jeck'; console.log('1:', name); } else { console.log('2:', name); } })()
var name = 'Tom'; (() => { if (typeof name === 'undefined') { name = 'jeck'; console.log(name); } else { console.log(name); } })() // 结果是 Tom
The text was updated successfully, but these errors were encountered:
No branches or pull requests
在ES5中主要使用匿名函数【IIFE】的方式来达到块级作用域的效果
所以,上面代码实际执行顺序如下:
变换
The text was updated successfully, but these errors were encountered: