JSFiddle - React, Tailwind, and code Playground
by blesh
JavaScript
function removeDuplicates(arr) {
var out = [];
for (var i = 0; i < arr.length; i++) {
var item = arr[i];
if (out.indexOf(item) === -1) {
out.push(item);
}
}
return out;
}
console.log(removeDuplicates([1,2,3,4,1,2,3,1,2,3,4,5,6,1,2,3,4,7,8,9,6,7,8]));
var x= { foo: 'bar' };
var y = { bar: 'foo' };
console.log(removeDuplicates([x,x,x,x,y,y,x,y,x,y,1,2,3,x]));