Uncaught TypeError: Cannot set property '0' of undefined \"
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: i'm getting the error Uncaught TypeError: Cannot set property '0' of undefined for some reason in this line world_map_array[i][z]="grass.gif|ongrass.gif|collision.gif|above.gif"; Why is this happening? thanks for any help var x_world_map_tiles = 100; var y_world_map_tiles = 100; var world_map_array = new Array(x_world_map_tiles); for (i=0; i 回答1: Arrays in JavaScript have quirks of their own that you may not be expecting if you come from other languages. Two important ones for your use case are: You cannot directly declare multidimension