const b = [5, 2, 3, 1, 8];
var a = [],
i;
for (var i = 0; i < b.length; i++) {
var num = b[i];
a[num] = a[num]||0;
a[num] ++;
num == null;
}
for (var i = 0; i < a.length; i++) {
if(a[i]) console.log(i);
}
const b = [5, 2, 3, 1, 8];
var a = [],
i;
for (var i = 0; i < b.length; i++) {
var num = b[i];
a[num] = a[num]||0;
a[num] ++;
num == null;
}
for (var i = 0; i < a.length; i++) {
if(a[i]) console.log(i);
}
声明: 本文采用 BY-NC-SA 授权。转载请注明转自: levy