2个回答
2017-11-14
展开全部
出个考察执行顺序的setTimeout(() => {
console.log(1)
}, 100)
console.log(2);
new Promise((res) => {
console.log(3)
res(4)
}).then(res => {
console.log(res)
})
setTimeout(() => {
console.log(5)
}, 0)
出个考察作用域的a = 1;
b = 2;
c = 3;
var obj = {
a: 'a',
b: 'b',
c: 'c',
actionA: () => {
console.log(this.a);
},
actionB() {
console.log(this.b);
},
actionC,
}
function actionC() {
console.log(this.c);
}
obj.actionA();
obj.actionB();
obj.actionC();
actionC();
console.log(1)
}, 100)
console.log(2);
new Promise((res) => {
console.log(3)
res(4)
}).then(res => {
console.log(res)
})
setTimeout(() => {
console.log(5)
}, 0)
出个考察作用域的a = 1;
b = 2;
c = 3;
var obj = {
a: 'a',
b: 'b',
c: 'c',
actionA: () => {
console.log(this.a);
},
actionB() {
console.log(this.b);
},
actionC,
}
function actionC() {
console.log(this.c);
}
obj.actionA();
obj.actionB();
obj.actionC();
actionC();
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询