Advertisement
Spocoman

02. Common Elements

Jan 22nd, 2022
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function solve(firstArray, secondArray) {
  2.  
  3.     for (let i = 0; i < firstArray.length; i++ ) {
  4.         for (let j = 0; j < secondArray.length; j++ ) {
  5.             if (firstArray[i] === secondArray[j]) {
  6.                 console.log(firstArray[i]);
  7.             }
  8.         }
  9.     }
  10. }
  11.  
  12.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement