JSFiddle - React, Tailwind, and code Playground
by mrtoxas
JavaScript
const arr = [1, 1, 2, 3, 4, 5, 6, 7, 7, 8, 9]
const res = arr.reduce((acc, val) => {
if (acc.indexOf(val) < 0 ) acc.push(val);
return acc;
}, []);
console.log(res)
by mrtoxas
const arr = [1, 1, 2, 3, 4, 5, 6, 7, 7, 8, 9]
const res = arr.reduce((acc, val) => {
if (acc.indexOf(val) < 0 ) acc.push(val);
return acc;
}, []);
console.log(res)