Double Dimensional Array in Javascript Returning Undefined Array -
Double Dimensional Array in Javascript Returning Undefined Array -
this question has reply here:
javascript 2 dimensional arrays [duplicate] 6 answersi have searched alot , cannot clear reply problem.
var rowcount = 3; var mycounter = 0; var mynewarray = new array(); (var = 1; < rowcount; i++) { seek { mynewarray[mycounter][0] = i; mynewarray[mycounter][1] = i; mycounter = mycounter + 1; } grab (err) { alert(err.message); } }
it giving , exception saying mynewarray[mycounter] undefined. thought why? have seen other post , have shown declare array or new array([]). nil working. need help, in advance give thanks you.
currently mynewarray
array elements trying access in not yet exist (undefined) need set these elements arrays
var rowcount = 3; var mycounter = 0; var mynewarray = new array(); (var = 1; < rowcount; i++) { seek { //set element array if want access array mynewarray[mycounter] = []; mynewarray[mycounter][0] = i; mynewarray[mycounter][1] = i; mycounter = mycounter + 1; } grab (err) { alert(err.message); } }
javascript arrays multidimensional-array
Comments
Post a Comment