Output should be [2,3,5,9] for both a
and b
as per me, as they both point to same address, and the data has a push of 9
. Why the result is still the old data of [2,3,5]?
var a = [2,3,5];
var b = a;
b.push[9];
console.log(a, b);
Output should be [2,3,5,9] for both a
and b
as per me, as they both point to same address, and the data has a push of 9
. Why the result is still the old data of [2,3,5]?
var a = [2,3,5];
var b = a;
b.push[9];
console.log(a, b);