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'; (function() { if (typeof name == 'undefined') { name = 'Jack'; console.log('Goodbye ' + name); } else { console.log('Hello ' + name); } })();
The text was updated successfully, but these errors were encountered:
hello Tom
解析: 1、首先在进入函数作用域当中,获取name属性 2、在当前作用域没有找到name 3、通过作用域链找到最外层,得到name属性 4、执行else的内容,得到Hello Tom
Sorry, something went wrong.
No branches or pull requests
The text was updated successfully, but these errors were encountered: