A resourceful newsletter featuring the latest and most important news, articles, books and updates in the world of #javascript π Don't miss our Quizzes!
Let's chat: @nairihar
Post #2334
5.03K
CHALLENGE
function modify(obj) {
obj.a.push(4);
obj.b = 'changed';
return obj;
}
const original = { a: [1, 2, 3], b: 'original', c: { deep: true } };
const copy1 = { ...original };
const copy2 = JSON.parse(JSON.stringify(original));
modify(copy1);
console.log(original.a, original.b, copy2.c === original.c);- π 5
- β€ 1
- π€© 1



