×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Javascript
Posted by: Chris Beardsley
Added: Oct 23, 2018 3:08 PM
Views: 3510
Tags: no tags
  1. let bobsFollowers = ['A', 'B', 'C'];
  2. let tinasFollowers = ['C', 'B'];
  3. let mutualFollowers = [];
  4.  
  5. for(var i=0; i < bobsFollowers.length; i++){
  6. for(var j=0; j < tinasFollowers.length; j++){
  7. if (bobsFollowers[i]===tinasFollowers[j]){
  8. mutualFollowers.push(tinasFollowers[j]);
  9. }}
  10. }
  11. console.log(mutualFollowers);