How to remove the duplicate strings in an array. I tried this which doesn’t workout.
var input = ['john','john','rio','ravi','josva','ravi'];
let remove = function(){
let result = [];
for (let i = 0; i<input.length; i++){
if(input[i] == input[i]){
return false;
}else{
return true;
}
}
result.push(input[i]);
console.log(result);
};
remove();
3
Answers
You can use this code:
You can do it this way also