1. <script>
    2. // 将数组分成三个
    3. var arr = [1,2,3,4,5,6,7,8,9];
    4. var test = [];
    5. for(var i=0;i<arr.length;i+=3){
    6. test.push(arr.slice(i,i+3));
    7. }
    8. console.log(test);
    9. </script>