var listData = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21];
var n = listData.length/7;
var a = ["a","b","c"];
var result = [];
for(i=0;i<n;i++){
result[i] = listData.splice(0,7);
result[i].unshift(a[i]);
result[i].filter(function (val, index, arr) {
if(index==3){
arr[index] = val+'%';
}
if(index==5){
arr[index] = val +'%';
}
return true;
});
var n = listData.length/7;
var a = ["a","b","c"];
var result = [];
for(i=0;i<n;i++){
result[i] = listData.splice(0,7);
result[i].unshift(a[i]);
result[i].filter(function (val, index, arr) {
if(index==3){
arr[index] = val+'%';
}
if(index==5){
arr[index] = val +'%';
}
return true;
});
}
输出结果