原始数组:[ [{A:a,B:b,C:c},{D:d,E:e,F:f},{H:h,I:i,J:j}],[{1:1,2:2,3:3}{4:4,5:5,6:6}],[{A:1,B:2,C:3},{D:4,E:5,F:6},{H:7,I:8,J:9}] ]
目标数组:A[{A:a,B:b,C:c},{D:d,E:e,F:f},{H:h,I:i,J:j}]
B[{1:1,2:2,3:3}{4:4,5:5,6:6}]
C[{A:1,B:2,C:3},{D:4,E:5,F:6},{H:7,I:8,J:9}]
第1个回答 2020-04-08
const [A,B,C] = [
[{A:'a',B:'b',C:'c'},{D:'d',E:'e',F:'f'},{H:'h',I:'i',J:'j'}],
[{1:1,2:2,3:3},{4:4,5:5,6:6}],
[{A:1,B:2,C:3},{D:4,E:5,F:6},{H:7,I:8,J:9}]
];
console.log(A,B,C)追问
[{A:'a',B:'b',C:'c'},{D:'d',E:'e',F:'f'},{H:'h',I:'i',J:'j'}],
[{1:1,2:2,3:3},{4:4,5:5,6:6}],
[{A:1,B:2,C:3},{D:4,E:5,F:6},{H:7,I:8,J:9}]
];
console.log(A,B,C)追问
如果不是固定的三个数组,我要怎么遍历?
追答你得把你实际需求说出来,不然就是耍流氓,鬼知道你想要什么效果,而且,哪个傻子会这样搞数据,把全部数据弄成一个数组,这不是找C么
本回答被提问者采纳