加班准备走...
在 twitter 上看到了个有意思的问题
我觉得如果有人说自己熟悉 es6 的话, 可以用这个来打脸
let x = 0;
async function test() {
x += await 2;
console.log(x)
};
test();
x+=1;
console.log(x);
这里输出了什么? 又是为什么呢?
答案:
https://www.youtube.com/watch?time_continue=278&v=bfxglBVSNDI
ps: 用这种题目做面试题估计又会被人说是造火箭吧. 我倒是觉得面试造火箭没啥错, 万一哪天在拧火箭的螺丝呢?
原文: https://twitter.com/jaffathecake/status/999269332889763840
