Skip to content

Latest commit

 

History

History
16 lines (10 loc) · 221 Bytes

array.md

File metadata and controls

16 lines (10 loc) · 221 Bytes

Array

Filter

Remove duplicates

const categories = ['A', 'A', 'B', 'C']

var result = categories.filter(function(c, i){
  return categories.indexOf(c) >= i;
});

// result => ['A', 'B', 'C']