consta=Array(3).fill([null,null,null])// Is not the same as constb=[[null,null,null],[null,null,null],[null,null,null]]/* because if you try to fill an element in one array in the first example
it fills all the array with the same element */a[1][2]="X";//This results in the following./*
=>
[[null, null, "X"]
[null, null, "X"]
[null, null, "X"]] /*
/* Aah freaking javascript. */
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Discussion on: What is the oddest JavaScript behavior?
For further actions, you may consider blocking this person and/or reporting abuse