Javascript Program to Remove Duplicates From Array Using Set() Method

You are currently viewing Javascript Program to Remove Duplicates From Array Using Set() Method

Javascript Program to Remove Duplicates From Array Using Set() Method

// program to remove duplicate value from an array
 
function getUnique(arr){
 
    // removing duplicate
    let uniqueArr = [...new Set(arr)];
 
    console.log(uniqueArr);
}
 
const array = [1, 2, 3, 2, 3];
 
// calling the function
getUnique(array);

Ranjith

Hi, I'm Manoj a full-time Blogger, YouTuber, Affiliate Marketer, & founder of Coding Diksha. Here, I post about programming to help developers.

Leave a Reply