[typo] My nested loop won't work?

Please, help!!! Why doesn’t work??? Error - Did you write a nested for loop?

let bobsFollowers=['Serg','Jan','Sam','Kate'];
let tinasFollowers=['Lena','Sam','Jan'];
let mutualFollowers=[];

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

when we try to log i:

for (let i=0;i<bobsFollowers.lenght;i++){
   console.log(i)

we get nothing. This seems to indicate the loop doesn’t run (doesn’t make any iteration)

so something is wrong with your loop condition. Check your spelling :wink:

1 Like

I don’t know if you got an answer but you spelled “length” as “lenght”

thank you very much !!!