// 把一个数组按照一定长度分割成若干数组

var itemLength = parseFloat(scoreData.length / 10);
                                    
                                    console.log(itemLength);
                                    // 把一个数组按照一定长度分割成若干数组
                                    function group(array, subGroupLength) {
                                        let index = 0;
                                        let newArray = [];
                                        var scoreArr = [];
                                        while (index < array.length) {
                                            newArray.push(array.slice(index, index += subGroupLength));
                                            scoreArr.push(Number((parseFloat(index)).toFixed()));//获取下标
                                        }
                                        var arrBox={
                                            newArray:newArray,
                                            scoreArr:scoreArr,
                                        }
                                        return arrBox;
                                    }
                                    let arrBox = group(scoreData, itemLength);

猜你喜欢

转载自blog.csdn.net/qq_35086913/article/details/107555780