今天发现一道很有意思的 JS 题目,如下:

let i = 0;
function x() {
i++;
return 10;
}
i += x();
console.log(i) // 10 or 11

i 的值最终是10还是11呢?来讨论一下为什么吧。
展开
评论