javascript - jQuery Create Multidimensional Array -
i having heck of time trying figure out how create multidimensional array in jquery.
i instantiate array outside of loop.
<script> var myarray = []; </script> inside of loop want add array elements.
= 0 [loop start] <script> myarray[i][$row[sku]] = $row[qty]; // sku might repeated cause issue? see in error below "295518" repeated... <script> [loop end] in source code looks this:
<script> myarray[ 1 ][ 295518 ] = 122; </script> then run @ end outside loop...
<script> console.log( myarray ); </script> i error in console:
uncaught typeerror: cannot set property '295518' of undefined uncaught typeerror: cannot set property '70252' of undefined uncaught typeerror: cannot set property '295518' of undefined what doing wrong in setting array? thanks!
you can so:
var = []; a[0] = [1,2,3]; a[1] = [4,5,6]; a[1][1] 5
Comments
Post a Comment