按唯一ID对数组进行分组

时间:2019-05-08 01:55:38

标签: javascript arrays

var title_hea=["snm","timestamp","Id","fault1","fault2","fault3","fault4","fault5","fault6","fault7","fault8","fault9","fault10"];
var unique_num=[125215041914320000,257414021945680000,444014021945680001,578714021945680002,404014021945680003,125215041914320000,969718021914789000,444014021945680001,125215041914320000];
var ident1=[0,0,0,0,0,0,0,0,1];
var ident2=[0,0,1,0,0,0,0,0,0];
var ident3=[0,1,0,0,0,0,0,0,0];
var ident4=[0,0,0,1,0,0,0,1,0];
var ident5=[1,0,0,0,0,0,0,0,0];
var ident6=[0,0,0,0,1,0,0,0,0];
var ident7=[0,0,0,0,0,0,0,0,1];
var ident8=[0,0,0,0,0,0,1,0,0];
var ident9=[0,0,0,0,0,0,0,0,0];
var ident10=[0,0,0,0,0,1,0,0,0];

我需要通过分组进行输出

通过将“ unique_num”分组,我想求和ident

假设unique_num[0] & unique_num [10]是相同的将其分组到相同的Unique_num[0]

求和ident1”和“ ident10”并放入==“ ident1

就像分组和旋转

0 个答案:

没有答案