Advertisement
divanov94

Untitled

Jun 7th, 2020
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function commonElements(arrOne,arrTwo) {
  2.     let output=[];
  3.     for(let i=0;i<arrOne.length;i++){
  4.         for(let k=0;k<arrTwo.length;k++){
  5.             if(arrOne[i]===arrTwo[k]){
  6.                output.push(arrOne[i]);
  7.                
  8.                
  9.             }
  10.            
  11.         }
  12.     }
  13.     for (const elem of output) {
  14.         console.log(elem);
  15.        
  16.        
  17.     }
  18.    
  19.  
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement