var a = {
b: function() {
console.log(this)
},
c: () => console.log(this),
d() {
console.log(this)
},
e() {
return new Promise(
() => console.log(this)
)
},
f: function() {
return new Promise(
() => console.log(this)
)
},
g: function() {
return new Promise(
() => console.log(this.axios)
)
},
i() {
return () => (
console.log(this.axios)
)
},
h() {
return () => ({
i() {
console.log(this.axios)
}
})
},
o() {
return () => {
return () => {
console.log(this.axios)
}
}
},
p() {
return () => {
return () => ({
i() {
console.log(this.axios)
}
})
}
},
u: () => ({
i() {
console.log(this.axios)
}
}),
y: () => ({
i: () => (console.log(this))
}),
}
// es6 浏览器隐式调用 strict mode。u内部所在作用于是window但箭头函数内的i的调用caller和argument受到限制,所以返回underfined
a.axios = 1;
axios = "";