From https://coderwall.com/p/nilaba?utm_campaign=coderwall-popular_protips&utm_content=2014-10-30+00%3A00%3A00+UTC&utm_medium=email
Array.prototype.unique = function() { return this.filter(function (value, index, self) { return self.indexOf(value) === index; }); } // usage: var arr = ['a', 1, 'a', 2, '1']; arr.unique(); // => ['a', 1, 2, '1']