Simple issue I am facing.
arr = [[1,2,3],[3,4,5],[6,7,8]];
x = arr[0];
x[0] = 2; //x returns [2,2,3]
At the same time arr is also updated to [[2,2,3],[3,4,5],[6,7,8]] How can I prevent this.I don't want arr to change and why does this happen?