What is wrong with my code? 9/2 If / else if / else


#1


Hi! I have looked at the code, and cannot find my mistake. Any help will be much appreciated!

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


Here is the error message I receive:
Oops, try again. Your function returns true for 3!


Here is my code:

var isEven = function(number) {
  if ((number % 2) === 0) {
      return "true"
  } else if (isNaN(number)) {
      return "You did not enter a valid number."
  } else {
      return "false"
  }
  
};
isEven(26)


#2

Hello,

if you use false or true, there are no " " needed!

You need to change in your code return "false" or return "true" to return false or return true.


#3

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