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? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
function fn(a) { console.log(a); var a = 2; function a() {} console.log(a); } fn(1);
The text was updated successfully, but these errors were encountered:
答案:f a() { } 2 解析:我们知道预解析阶段,变量声明和函数声明会提前,且变量名和函数名同名时,函数优先级高于变量,会覆盖变量,因此第一个输出的是f a(){ },继续执行,会执行a=2,再输出的时候就会输出2,不理解的同学百度一下变量提升和函数提升
Sorry, something went wrong.
No branches or pull requests
The text was updated successfully, but these errors were encountered: