2. If / else if / else - Code works but I get no "return"


#1


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


Hello!
My code is working but nothing appears at that black screen after "Save & Submit".
What am I doing wrong?

Thanks in advance.

var isEven = function(number) {
  // Your code goes here!
  if (number%2===0){
  return true
  }
  else if(isNaN(number)){
  return "Not a Number"
  }
  else{
  return false
  }
};


#2

You aren't doing anything wrong. You wrote an if statement saying that if it receives this input then run this code and so on. Nothing printed out to the console however because your if statement never received any input from the user.


#3

Ohhh I get it now! Thank you very much.


#4

No problem, I'm glad to help :slight_smile:


#5

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