标签:name var fun his cti div UNC turn make
var val = 1
var obj = {
val : 2,
dbl : function() {
var val = 45;
console.log(this); //指向谁?
this.val *= 2;
console.log(this.val); //??
console.log(val); //??
}
}
var fn = obj.dbl
fn()
var x = 12;
function test() {
console.log(this.x)
}
test() //??
var x = 12;
function test() {
console.log(this.x)
}
var obj={
x:45,
ss:test
}
obj.ss() //??
var x = 12;
function test() {
console.log(this.x)
}
var obj = {
x:45,
ss:function(){
console.log(this)
test()
}
}
obj.ss() //??
var val = 1
var obj = {
val : 2,
dbl : function() {
// var val = 45;
console.log(this); // 指向谁
this.val *= 2;
console.log(this.val); // ???
console.log(val); // ???
}
}
var ff = obj.dbl()
标签:name var fun his cti div UNC turn make
原文地址:https://www.cnblogs.com/qinlinkun/p/10055177.html