方法一:
var SplitArray = function(N,Q)
{
var R = [],F;
for (F = 0;F < Q.length;) R.push(Q.slice(F,F += N))
return R
}
var arr = [1,2,3,4,5,6,7,8,9,10,11,12];
console.log(SplitArray(5,arr))
var SplitArray = function(N,Q)
{
var R = [],F;
for (F = 0;F < Q.length;) R.push(Q.slice(F,F += N))
return R
}
var arr = [1,2,3,4,5,6,7,8,9,10,11,12];
console.log(SplitArray(5,arr))
本文标题:将一个数组中的元素按照顺序将其5个元素分一组存入数组中
本文链接:https://www.haomeiwen.com/subject/eusidxtx.html
网友评论