//定义一个空数组
var tempList = []
//定义一个数量(数组长度 / 要取数据得数量) 要 Math.round 四舍五入 加一
var count = Math.round(newV.length / 16) + 1
//循环数组
for(var p = 0, len = newV.length; p < len; p += count){
//切割数组并放到定义得新空数组中
tempList.push(newV.slice(p, p + count))
//当前取得数组就是每一段平均分得数组
console.log(tempList,'tempList')
在此次处理分割得数组
//在把数组等于空
tempList = []
}
不知数组长度 平均取数据(随机取数据)
最新推荐文章于 2021-02-02 14:37:28 发布