var A = [];
var obj = {
x: A[1],
y: 'hello'
};
A[1] = 1;
console.log(JSON.stringify(obj));
By the time I use objin console.log(), it is A[1]already defined.
How can I get the "last" objwith all its properties updated? So {"x":1,"y":"hello"}, when will we get it done console.log()?
source
share