我想知道bind()是否比初始化变量更快地执行?
I found obj is undefined when bind() is executed I've learned variables hoisting but I don't understand this situation about executing orders when Window APIs join in . var obj = {
foo:(function(){
return this
}).bind(obj)
}
obj.foo() //Window发布于 2019-05-13 04:00:43
问题是,当它们表示对象中的键值时,由于未初始化对象变量,因此无法访问对象变量。
var obj = {
test:obj
}
console.log(obj.test) //undefined
我想知道
bind()是否比初始化变量更快地执行?
是的,它在对象初始化之前执行。
https://stackoverflow.com/questions/56105553
复制相似问题