So recently i was studying for my interview, I came accross shallow copy and deep copy in javascript, I read some blogs and understood that it can be a huge problem. So i started to learn how to identify them, everything was going great until this example came
In this example, members array contains the original person object after setting it null
let person = {name : "Lydia"};
const members = [person];
person = null;
console.log(members);
But here when I do this
let person = {name : "Lydia"};
const members = [person];
person.name = null;
console.log(members);
The member array no longer contains the original object.
Please explain why this is happening, would appreciate any examples and reading material around this, thanks