js 一个数组改成两个一组两个一组
var arr= [];
var data=[{name:'abc1'},{name:'abc2'},{name:'abc3'},{name:'abc4'},{name:'abc5'},{name:'abc6'},{name:'abc7'}]
for(var i=0;i<data.length;i+=2){
arr.push(data.slice(i,i+2));
}
var arr= [];
var data=[{name:'abc1'},{name:'abc2'},{name:'abc3'},{name:'abc4'},{name:'abc5'},{name:'abc6'},{name:'abc7'}]
for(var i=0;i<data.length;i+=2){
arr.push(data.slice(i,i+2));
}