Https://www.codecademy.com/courses/introduction-to-javascript/lessons/loops/exercises/for-loops-iii

https://www.codecademy.com/courses/introduction-to-javascript/lessons/loops/exercises/for-loops-iii

Hello im stuck on this course. Im confused as to why I cant continue.
The last task is: 4.

Create a nested loop that iterates through bobsFollowers as the array for the outer loop and tinasFollowers as the array for the inner loop. If the current element from the outer loop is the same as the current element from the inner loop, push that element into the mutualFollowers array.

This is what I wrote.

// Write your code below

let bobsFollowers = [‘bob’, ‘bobby’, ‘bobster’, ‘bobber’];

let tinasFollowers = [‘tiny’, ‘bobby’, ‘bobster’];

let mutualFollowers = [ ]

for (let i = 0; i < bobsFollowers.length; i++){

for (let j = 0; j < tinasFollowers.length; j++)

if(tinasFollowers[j] === bobsFollowers[i]){

mutualFollowers.unshift(tinasFollowers[j])

}

}

console.log(mutualFollowers)

I put in a semicolons at the end of more of the lines, and it seems to work.

let bobsFollowers = ['bob', 'bobby', 'bobster', 'bobber']; let tinasFollowers = ['tiny', 'bobby', 'bobster']; let mutualFollowers = [ ]; for (let i = 0; i < bobsFollowers.length; i++){ for (let j = 0; j < tinasFollowers.length; j++) if(tinasFollowers[j] === bobsFollowers[i]){ mutualFollowers.unshift(tinasFollowers[j]); } } console.log(mutualFollowers);

Thanks for replying,
it worked the first time around however the autocheck still doesn´t seem to accept it as correct.

another thing you may want to try is using
mutualFollowers.push(tinasFollowers[j]);
instead of
mutualFollowers.unshift(tinasFollowers[j]);

sadly doesn´t change a thing