Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript remove duplicates

var arr = ["apple", "mango", "apple", "orange", "mango", "mango"];
  
function removeDuplicates(arr) {
	return arr.filter((item, 
		index) => arr.indexOf(item) === index);
}
  
console.log(removeDuplicates(arr)); // ["apple", "mango", "orange"]
Source by www.geeksforgeeks.org #
 
PREVIOUS NEXT
Tagged: #javascript #remove #duplicates
ADD COMMENT
Topic
Name
1+7 =