I have an array of coordinates (coods), which are therefore smaller arrays, which I want to add new arrays to. I want it to look like this:
[
[0,2],
[0,1],
[0,0]
]
I want to do this by adding a constantly changing variable new to it every time the code runs:
coods.unshift(new);
The only problem is that (as took me forever to discover), when passing a new array into the larger array it is only passing a reference, not the value itself, so I end up having a coods array of:
[
[0,2],
[0,2],
[0,2]
]
How can I fix this?