var?name="hello";
var?o={
????name:"hi"
}
var?sayName?=??function?()?{
????console.log(name)
}
sayName();?//hello
sayName.call(o);?//hello
o.sayName=sayName;
o.sayName();?//hello這段代碼,為什么后兩個的輸出都是hello,不應該是hi嗎?
js中的變量查找問題
小熊熊HELLO
2018-10-07 14:30:24