Why doesn't the nested loop compare length?

I just wanted a bit of confirmation. I have the correct code but just wanted to clarify something that didn’t make sense to me.

If I run the loop for either bobsFollowers or tinasFollowers the output is the number of items are in the array (i.e 4). But running the nested loop compares the names and produces the names that match.

I suppose what I’m asking is why isn’t it comparing number of items or lengths?

My code below:

// Write your code below
const bobsFollowers = ['Tasha','Jane','Mark','Steven'];
const tinasFollowers = ['Tasha','Ryan','Jane'];

const mutualFollowers = [];

for(let i = 0; i < bobsFollowers.length; i++){
  for(let j = 0; j < tinasFollowers.length; j++){
    if(bobsFollowers[i] === tinasFollowers[j]){
     mutualFollowers.push(tinasFollowers[j]);
    }
  }
};

console.log(mutualFollowers);
//output:  [ 'Tasha', 'Jane' ]
1 Like

Because that is trivial information. All we want is the matches.