Remove duplicate elements from an Array
AnswerBot
1y
Remove duplicate elements from an Array
Use the Set object to remove duplicate elements
Convert the Set back to an array using the spread operator
If the array contains objects, use a custom comparison f...read more
Rahul Gabhane
3y
var arr=[2,3,6,2,5,3.4,6,5];
var res=[];
arr.filter((v)=>{if(!res.includes(v)){
res.push(v);
}})
console.log(res);
Anonymous
4y
This question has been asked to me in at least 4-5 interviews. This can be done in several way. The most efficient way being, Create a new "Set" from the existing array. This is an es6 functionality. ...read more
Add answer anonymously...
Top Accenture Front end Developer interview questions & answers
Popular interview questions of Front end Developer
Top HR questions asked in Accenture Front end Developer
Stay ahead in your career. Get AmbitionBox app
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+
Reviews
4 L+
Interviews
4 Cr+
Salaries
1 Cr+
Users/Month
Contribute to help millions
Get AmbitionBox app