Immutable Objects using Object.assign
Is immutability important? Mutating data can produce code that’s hard to read and error prone. But we can avoid this mess using vanilla javascript’s ES6 feature Object.assign! Let’s look at the problem…. When we changed obj2’s key property, it also changed obj1’s key property. No bueno! The solution: As you can see we changed obj2’s […]