How to define a two-dimensional array in JavaScriptCategory: JS JavaScript two-dimensional array of arrays JS cyclic array assignment 2011-12-14 11:14 136 people read comments (0) Collection report
JavaScript two-dimensional array definition [a]:
JavaScript code <script> var a=new Array (); A[1]=new Array ("A", "B"); </script>
--------------------------------------------------------------------------------
JavaScript two-dimensional array definition [II]:
JavaScript code <script language= "JavaScript" > <!-- var a = new array (); a[0] = new array ("A", "B"); a [1] = new array ("C", "D"); alert (a[1][1]); //--> </script>
--------------------------------------------------------------------------------
JavaScript two-dimensional array definition [three]: »
JavaScript code var arr = new array ([1,2,3],[4,5,6],[7,8,9,10]); for (Var e in arr) alert (Arr[e]);
--------------------------------------------------------------------------------
JavaScript two-dimensional array definition [Four]: »
Declare an array first: &NBSP;&NBSP;&NBSP
JavaScript code var A=new arrray _num); a[first_num]=new array (number); a[first_num]=new array (number); //first_name is the dimension, // Number can come in accordance with your needs. //This can create multidimensional arrays. &NBSP;&NBSP;&NBSP;&NBSP;&NBSP
--------------------------------------------------------------------------------
JavaScript two-dimensional array definition [Five] »
JavaScript code <script> T=new array; T[1]=new Array; t[1][0]= "A"; t[1][1]= "B"; alert (t[1][0]); </script>
--------------------------------------------------------------------------------
JavaScript two-dimensional array definition [VI] »
JavaScript code <script> var result = new array (New array ("1", "1111"), new array ("2", "2222") , new array ("3", "3333"), new array ("4", "4444"); for (var i=0;i< result.length;i++) { alert (result[i][0]+ "|") +RESULT[I][1]); } </ script>