61
I need to copy an object in JavaScript, but changes to the copy affect the original object. What's happening?
const original = { name: 'John', address: { city: 'NYC' } };
const copy = { ...original };
copy.address.city = 'LA';
console.log(original.address.city); // 'LA' - Why?!How do I make a true deep copy?