var arr = [0, 1, 2, 2, 3, 3, 5];
var dups = arr.filter ( (v,i,a) => a.indexOf(v) < i );
console.log(dups);
[
2,
3
]
when v=2, a.indexof(2)=2,but i=3
so filter 2 to the dups
var arr = [0, 1, 2, 2, 3, 3, 5];
var dups = arr.filter ( (v,i,a) => a.indexOf(v) < i );
console.log(dups);
[
2,
3
]
when v=2, a.indexof(2)=2,but i=3
so filter 2 to the dups
For further actions, you may consider blocking this person and/or reporting abuse
Discover the future of cloud security. Tune in live for trends, tips, and solutions from AWS and AWS Partners.
Mike Young -
Mike Young -
Mike Young -
Ashitosh Shinde -
Top comments (0)