If/Else if


Hello can anyone see what is wrong with this code?

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

Saying syntax error at the moment. We dont have to directly assign a value to number do we?
I assume its only an issue with the isNaN since didnt have issue in last part of the lesson


Your else if block,

should check for true,

else if (isNaN(number) === true) {


bandit, that is not true? isNaN will return true if it is not a number, which means the if condition will evaluate to true, even if you don't compare it with true

@peroxis, isNaN should have a uppercase N at the end, not a lowercase


yep that worked thanks. glad that was the problem less confusing for my logic


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.