1. If/Else


Below is my code. It might look like the code of other people but I keep getting syntax errors. I don't see what I'm doing wrong, an someone please help me?

var isEven = function(number) {
// Your code goes here!
if(number % 2 === 0)
return true;
else if(isEven("number"));
return "Now What?";
return false;


this line:

else if(isEven("number"));

that is one very dangerous semi-colon, it causes your else if to not execute correctly


On your else if statement then the semicolon shouldn't be there, just curly brackets.


I took that out and this is what I got - Oops, try again. It looks like you have an error in your code! See the error message for more: RangeError: Maximum call stack size exceeded


Just as I spotted it and was about to post my answer then you posted yours :slight_smile:


Could you please post the link to the exercise?




your else if has another problem:

else if(isEven("number"))

you call the function, which will mean the function will endless call itself. You should use isNaN to check if the number variable (variable, so no quotation marks) is a number


Now I get isNAN is not defined. Where does it say to use that?


I'm lost and confused at this point. I don't understand what it's asking for.


why on earth do you even have else if? That is exercise 2, you are at exercise 1


I took out the quotes and it just worked. Thank you all for your help.