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
function a(){ this.b = 3 } var c = new a() a.prototype.b = 7 var b = 9 a() //说出输出什么 console.log(b) console.log(c.b)
var a=33; function test(){ console.log(a) var a='eee' } test() //输出什么
window.name = 'bytedance' function A() { this.name = '123' } A.prototype.getA = function () { console.log(this) return this.name + 1 } let a = new A() let funcA = a.getA //输出什么 funcA() a.getA()
The text was updated successfully, but these errors were encountered:
这道题考察的是变量提升中,函数是一等公民
var temp = 1; function test() { temp = 10; return; function temp() {} } test(); console.log(temp);
temp的输出结果是1。 分析:因为在test函数里,function temp() {}首先被函数声明提升,此时temp = function (){} (类似于temp变量在函数内部被声明了),然后再执行语句 temp=10,相当于此时temp=10修改的是test函数作用域里的temp,没有修改外面的temp。所以在全局变量作用域里输出时输出的是全部变量temp,此时为1
Sorry, something went wrong.
No branches or pull requests
The text was updated successfully, but these errors were encountered: