• js 一个数组改成两个一组两个一组


    var arr= [];

    var data=[{name:'abc1'},{name:'abc2'},{name:'abc3'},{name:'abc4'},{name:'abc5'},{name:'abc6'},{name:'abc7'}]


    for(var i=0;i<data.length;i+=2){
    arr.push(data.slice(i,i+2));
    }

  • 相关阅读:
    编程心得5
    编程心得2
    心得2
    心得1
    7-11
    7-13
    7-9
    7-8
    7-12
    7-14
  • 原文地址:https://www.cnblogs.com/yaoling/p/13674265.html
Copyright © 2020-2023  润新知