If / esle if/ if BUG



My function is called once and should only run once, it didn't work like it should so I asked a more experienced programmer for help and we did some testing in my program. It turned out that my function was called about +1000 times but for no reason to be found in my program.

isEven =function (number) {
  // Your code goes here!
  //I used the console.log to test what's wrong 
  if (number%2===0) {
        return true;
  else if (isNaN(number)) {
  else {
        return false;
  return false;



you log a string to console when number is not a number, it should return the string instead

Yea, the exercise needs to validate your function works correctly, how do you think this is achieved? Indeed, by calling the function


I get this problem in my output


when the function input isn't a number, return a string. You log a string to the console when function input is not a number

logging != returning

I already covered this in my first answer?


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