Remove Duplicate Items from an Array with JavaScript

Have an array with duplicated you need to remove?

Array filter is your friend.

var arrayWithDuplicates = ['hi', 'yo', 'whatup', 'bye', 'lol', 'yo', 'hi', 'bye'];
var deDupedArray = arrayWithDuplicates.filter(function (arrayItem, index) {
                       return arrayWithDuplicates.indexOf(arrayItem) === index;
                   });
console.log(deDupedArray); // ["hi", "yo", "whatup", "bye", "lol"]