Good afternoon, I have this little program:
let oi=[1,2,3,4]
let xau=[]
xau=oi
xau[2]=7
console.log(oi)
My problem is that when in the console the output is:
[1,2,7,4]
According to what I understand, xau should be a new instance that has the values of hi, but when modifying xau, tbm modifico hi, if someone can explain to me why this is happening and how do I can modify xau without modifying hi, I am grateful