Nested Loop - Mutual Followers Exercise

Hello Everyone,

I was solving this problem above and entered the following code -

let bobsFollowers = [‘omar’,‘tom’,‘fred’,‘binny’];
let tinasFollowers = [‘tom’,‘jill’,‘fred’];
let mutualFollowers = ;

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


I get a response that says " Syntax Error - Illegal Return Statement’

Why is this an illegal return statement? If you remove the return word it works fine, but I want to know why it is illegal to use return there. Thank you to anyone who can help.

Hello @board7501978669, welcome to the forums! return is used to exit a function, and pass data back to the caller. Keeping this in mind, you can only use the return keyword in functions. Do you your return inside a function?