How do I copy an object in JavaScript? It’s a simple question, without a simple answer. Chinese translation: 中文版 Russian translation: русском Uzbek translation: O'zbek Call by reference JavaScript passes everything by reference. In case you don’t know what that means, here’s an example: function mutate(obj) { obj.a = true; } const obj = {a: false}; mutate(obj) console.log(obj.a); // prints true Th
![Deep-copying in JavaScript — surma.dev](https://cdn-ak-scissors.b.st-hatena.com/image/square/71edf041a21d38a92236d56ea5264768a56a3c7b/height=288;version=1;width=512/https%3A%2F%2Fsurma.dev%2Fthings%2Fdeep-copy%2Fsocial.png)