Recently I am facing problem with javascript sub object value assign. My sample code is
var user = {
name: {
fname: 'Apple'
}
};
console.log(user);
user.name.fname = 'Orange';
console.log(user);
So its console twice But, fname value always show Orange. But I want output will be Apple then Orange. How do i do that or actually what happened? Please Let me explain actually what going on.