loading...

Remove duplicates from an array

318097 profile image Mehul Lakhanpal Originally published at codedrops.tech ・1 min read
const array = [1, 1, 2, 3, 5, 5, 1];
const uniqueArray = [...new Set(array)];

console.log(uniqueArray); // [1, 2, 3, 5]

Thanks for reading 💙

Follow @codedrops.tech for daily posts.

InstagramFacebook

Micro-Learning ● Web Development ● Javascript ● MERN stack

codedrops.tech

Discussion

pic
Editor guide