javascript - No idea why I get: Uncaught TypeError: Cannot read property '0' of undefined -
so want check spot in two-dimensional array, have no idea why chrome returns:
"uncaught typeerror: cannot read property '0' of undefined".
in function put()
check if fieldspaces[column][row]
equal empty
this js-code:
var empty = 0; var fieldspaces = new array(7); (var column = 0; column < 7; column++) fieldspaces[column] = new array(6); (var column = 0; column < 7; column++) (var row = 0; row < 6; row++) fieldspaces[column][row] = empty; function checkempty(c){ var top = 5; var column = c; var isempty = false; if(fieldspaces[column][0] == empty){ console.log("it empty"); } }
Comments
Post a Comment