Hey all, first of all thanks for looking at my post, hopefully you can answer my question.
Exercise Link: https://www.codecademy.com/courses/introduction-to-javascript/lessons/loops/exercises/for-loops-iii
Please see my code below.
I can can log the resulant array to the console, yet I get a ‘Did you write a nested for loop?’ error.
let bobsFollowers = ['Ash','Barry','Calum','Denny'];
let tinasFollowers = ['Ash','Denny','Rob'];
let mutualFollowers = [];
for (i = 0 ; i < bobsFollowers.length ; i++ )
{
for ( j = 0 ; j < tinasFollowers.length ; j++ )
{
if (bobsFollowers[i] === tinasFollowers[j] )
{
mutualFollowers.push(bobsFollowers[i]);
}
}
};
console.log(mutualFollowers);
the console logs the two like names into the array, and the second for loop is clearly nested within so its clearly not a typo error.
I also took care to use the first array as the outer loop following the instructions.
(Note the same error occurs even when removing console.log)
Please advise