Else if


#1


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


Oops, try again. It looks like you have an error in your code! See the error message for more details: ReferenceError: isNan is not defined


 var isEven = function(number) {
  
  if(number%2 === 0){
      console.log("true");
  }
  else if(isNan ){
      console.log("I understand");
  }
  else{
      console.log("false");
  }

};
isEven(3);


#2

A couple things wrong here.

You are supposed to use return statements inside of functions instead of console.log.

isNan should be structured like this (isNaN(number)) - Capitalisation is important.

You are also supposed to return Boolean values true and false rather than the strings true and false. But you are right when you return a string for the isNaN else if.


#3

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