What is wrong with these return statements?


#1

So, I have tried this code a few times, and these return statements seem to be messing it up. All I have been told is that they are illegal return statements... (See picture... Though this is not the whole code). Any thoughts?


#2

Post your whole code.

Most likely you are using isEven in the if instead of the proper argument.

This can lead to recursion which isn't what you want at this time.


#3

instead of

if (isEven % 2){
    return true;
}

try

if (isEven){
   return true;
}

#4

Here is the entire code

var isEven = 86

if(isEven%2)
{
return true
}
else
{
return false
}


#5

Are you saying that if I just use 86 rather than isEven, would that work?


#6

it still says that the return statements are illegal... why?


#7

Hi inside your if statement you missing === 0 after your number 2 like that

if (isEven % 2 === 0)