remove duplicates from an array JS
Remove Duplicates from an array JS
let arr = [1,2,3,4,1,2,3,5]
let removeDuplicate = [...arr];
for(i=0; i<removeDuplicate.length; i++){
for(j=0; j<removeDuplicate.length; j++){
if(i !== j){
if(removeDuplicate[i] === removeDuplicate[j]){
// removing the duplicates from this arr.
removeDuplicate.splice(j,1);
}
}
}
}
console.log(removeDuplicate)