I am confused in javascript shallow copy
'a' array wasn't affected. const a = [1,2,3] const b = [...a] // shallow copy b[0] = 9 console.log(a) // [1,2,3] console.log(b) // [9,2,3] results as expected ---------- const a = [{name:"John"},{name:"George"}]; const b = [...a]; b[0] = {name:"Oliver"} console.log(a)…