let obj = { apple: 12, mango: 13 };
basket = obj;
basket.apple = 45;
basket.banana = 15;
console.log(obj);
output:
{ apple: 45, mango: 13, banana: 15 }
I am not updating "obj", how's its value get updated?
But in case of numbers and string when we update a variable it will not update another variable which we copies the value from.
var a = 45;
var b = a;
b = 99;
console.log(a,b) //45, 99