Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | edwood |
I define a constant and a variable. I assign the constant to the variable and manipulate the variable but I don’t know why the constant also changes.
Code:
const DEF = [[0,2],
[1,1],
[2,2],
[3,3]]
var deflist
deflist[0][1] *= 1.5
Then the output shows that DEF[0][1] also changes to 3.
It is weird that a constant is not constant even I have done nothing on it.
Does anyone know what happens?