SHARE
TWEET

Untitled

a guest Jun 17th, 2019 52 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var A = [3 ,4 ,1 ,4 ,1];
  2. let h  = {}
  3.  for(let i =0;i<=A.length-1;i++){
  4.       if(h[A[i]]!=null){
  5.           h[A[i]]+=1
  6.        }
  7.       else{
  8.          h[A[i]]=1
  9.       }
  10.      
  11.      
  12.   }
  13.  
  14.  for (var key in h) {
  15.    if(h[key]>1){
  16.      console.log(key)
  17.    }
  18.  
  19. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top