We have variable "a" and we want to create variable "b" as a mirror of "a" variable and then change one of its elements.
Code
function h(){
var a=[[1,2,3]]
var b=a;
b[0][0]="test"
Logger.log(b)
Logger.log(a)
}
Output
[[test,2,3]]
[[test,2,3]]
Why is this happening? Any way to avoid this?