Unusual Error


#1


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


The error message is always "Oops, try again. Looks like your function returns false when number = 3. Check whether your code inside the if/else statement correctly returns true if the number it receives is odd."


var isEven = function(number) {
  var val = number % 2 ;
  if ( val === 0){
      return "true"
  }else{ 
      return "false"
  }  
};
isEven(4)


#2

HI just remove the " " around true and false because it make them string


#3

Thanks for the help it works


#4

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