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']

Last updated

Was this helpful?