见下面给出的情景
var x = [];
x['abc'] = "hello";
console.log(x.length); //returns 0
var x = [1,2];
x['abc'] = "hello";
console.log(x.length); //returns 2
Run Code Online (Sandbox Code Playgroud)
这背后的任何原因或我错过了什么?
我对输出有些困惑。用Java尝试
var x = 1;
x = x++;
console.log(x); //Its output is 1
Run Code Online (Sandbox Code Playgroud)
我当时认为应该是2.,因为我要在后期增加后进行打印。有什么看法吗?