-3

My idea for how to solve this is to use the .filter method:

const array = [1,1,2,2,3,4,5,6,6,7,8,9];

let filteredArray = array => array.filter(function(item, index) {
    array.indexOf(item) === index;
});

console.log(filteredArray);

This does not return correctly but I'd like to solve this using a .filter method if possible. Any ideas.

tokugawa
  • 9
  • 2

0 Answers0