Need help: More on Control Flow in JS


#1



https://www.codecademy.com/courses/javascript-beginner-en-qDwp0/0/1?curriculum_id=506324b3a7dffd00020bf661#


It is giving me: SyntaxError: Unexpected token else
How do I fix this?


var isEven = function(number) {
  // Your code goes here!
  if (2%2) {
  return true;
  };
  
  else (
    return false;
    )
};


#2

Your supposed to check if the number is an even number not if 2 % 2.
How to check if a number is even is like this

number % 2 === 0


#3

Ah, I changed that then. But its still giving me: SyntaxError: Unexpected token else


#4

I think it needs to be like this. I'm pretty sure it's cause you'r missing curly brackets...

else
{ (
return false;
)
}


#5

Ah, I figured it out! I just had to remove one of the semicolons ^^'
Thanks for the help!


#6