假设有一个数组是这样varqq=[{"group":100,"info":{"event":123},"main":true,},{"group":100,"info":{"event":323},"main":true,"sp":1},{"group":103,"info":{"event":123},"main":true,"sp":13,},{"group":103,"info":{"event":323},"main":true,"sp":10},{"group":103,"info":{"event":123},"main":true,"sp":1}];group是同数字表示是一组的,我想把sp是1的,都放到同组的第一个,并且把main改成false,这具体该怎么实现?有大神可以帮我试试吗最终结果要是这样varqq=[{"group":100,"info":{"event":323},"main":false,"sp":1},{"group":100,"info":{"event":123},"main":true,},{"group":103,"info":{"event":123},"main":false,"sp":1},{"group":103,"info":{"event":123},"main":true,"sp":13,},{"group":103,"info":{"event":323},"main":true,"sp":10}];
相关分类