Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function commonElements(arrOne,arrTwo) {
- let output=[];
- for(let i=0;i<arrOne.length;i++){
- for(let k=0;k<arrTwo.length;k++){
- if(arrOne[i]===arrTwo[k]){
- output.push(arrOne[i]);
- }
- }
- }
- for (const elem of output) {
- console.log(elem);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement