sanjay555

RemoveDuplicate

Jan 9th, 2018
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. let a = ['a', 'a', 'b', 'a']
  2. let count = 0
  3. for(var i = 0; i <= a.length; i++){
  4.   console.log(`i> ${a[i]}`)
  5.   for(var j = 0; j <= a.length; j++) {
  6.     console.log(`J> ${a[j]}`)
  7. // from array a if char is  >= 3 remove from array a
  8.     if(a[i] == a[j]){
  9.       count = count + 1
  10.     }  
  11.    
  12.   }
  13. }
  14. console.log(count)
Add Comment
Please, Sign In to add comment