日期:2014-05-16 浏览次数:20377 次
window.onload=function(){
var arr=[1,2,3,4],
ar=Array();
k=0;
for(var i = 0; i< 2;i++){
for(var j =0; j<2;j++){
ar[i][j]=arr[k];
k++
}
}
alert(ar);
}
var arr = [1,2,3,4],
var ar = [];
var t = []
for(var i=0; i<arr.length; i++){
t.push(arr[i]);
if(t.length == 2) {
ar.push(t);
t = [];
}
}
alert(ar[1]);