Hi Community I struggle to understand the following behavior. Its a typicall Monday problem. All I want is to fill the empty array slots with the integer 0.
myArray = [
[1, ,1, ],
[ , ,1, ],
[ , ,1, ],
[1, , , ],
]
for (var a = 0; a < myArray.length; a++) {
for (var b = 0; b < myArray[a].length; b++) {
if (myArray[a][b] == undefined) {
myArray[a][b] = 0
}
}
console.log("myArray[" + a + "]["+ b +"]" + " = " + myArray[a][b])
}