Contact: aviboots(AT)netvision.net.il
39,926 questions
51,859 answers
573 users
const arr = [6, 7, 2, 8, 2, 5, 5, 8, 7, 8, 3, 2, 8, 8, 2, 8] const map = arr.reduce((acc, el) => acc.set(el, (acc.get(el) || 0) + 1), new Map()); console.log([...map.keys()]) /* run: [ 6, 7, 2, 8, 5, 3 ] */
const arr = [6, 7, 2, 8, 2, 5, 5, 8, 7, 8, 3, 2, 8, 8, 2, 8] const unique = [...new Set(arr)] console.log(unique); /* run: [ 6, 7, 2, 8, 5, 3 ] */