I just noticed something weird with cloning and pushing items. Here's example:
let a = { foo: [1,2] };
let b = Object.assign({}, a) // cloning object and getting new reference
a === b // gives false which is what I want
now I do push on object a:
a.foo.push(3)
now a.foo is [1,2,3] but b.foo is also [1,2,3]
but if I do
a.foo = a.foo.concat(4)
a.foo is [1,2,3,4] and b.foo is [1,2,3]
Question is: Why is that?
 
     
    
 
     
     
    