0

I have the below code

const a = [1,2];
const b = a;

b.push(3);
console.log(a); //[1,2,3]
console.log(b); //[1,2,3]

Can anyone explain me what happens here and how I can only mutate "b" array instead of adding "3" to array "a"

0 Answers0