I am learning Javascript. Trying to understand code,
function foo (){
var a = b = {name: 'Hai'};
document.write(a.name +'<br>');
document.write(b.name +'<br>');
a.name = 'Hello';
document.write(a.name +'<br>');
document.write(b.name +'<br>');
}
The output is as follows,
Hai
Hai
Hello
Hello
While it is true that the assignment takes from Right to Left, the updates are impacting on both directions. Is this how it works? Can someone explain this?