假设一个数组长这样varqq=[{"group":100,"info":{"event":123},"main":true,},{"group":100,"info":{"event":323},"main":false,"sp":12},{"group":103,"info":{"event":123},"main":true,"sp":13,},{"group":103,"info":{"event":323},"main":false,"sp":10},{"group":103,"info":{"event":123},"main":false,"sp":1}];group是同数字表示是一组的,我想要把同一组的放在一起,還有一個特殊情况,sp===1的话,就把它放到前一个阵列的最后一个位置也就是最后输出要这样varqq=[[{"group":100,"info":{"event":123},"main":true,},{"group":100,"info":{"event":323},"main":false,"sp":12},{"group":103,"info":{"event":123},"main":false,"sp":1}],[{"group":103,"info":{"event":123},"main":true,"sp":13,},{"group":103,"info":{"event":323},"main":false,"sp":10}]];这样具体该怎么实现?
添加回答
举报
0/150
提交
取消