// x = [7,2]
let x = [7, 2];
// y = [[7,2]]
let y = [x]
// x = [9,2]
x[0] = 9;
// y also = [[9,2]]
console.log(y);
Why is it that when I changed x, y changed as well? Shouldn't y still be what it was when I initialized it [[7,2]]? What is this phenomenon called?