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]);
}
}
};
console.log(mutualFollowers);
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.