This is the code:
var master = [];
var obj = {};
obj.name = "A";
master.push(obj);
console.log(master);
obj.name = "B";
master.push(obj);
console.log(master);
Following is the output on console:
The name property should be A at one place and B at another place
But both properties are displayed as B only.
How to avoid this overriding?