var a = 1
function text () {
console.log(this,1111)
console.log(this.a,'hello')
}
function text_a () {
var a = '2'
console.log(this,'hello world')
console.log(this.a,'world')
text()
}text_a()
在 text_a 里调用了 text() 方法 , 此时 text() 方法内部的 this 应该指向哪里 ? 为什么 ?
this
内置函数(apply
,call
,bind
)this
指针指向该对象new
操作符调用函数window
,严格模式下,为undefined
)