If / else


#1


More on control flow in JS: If/else

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) {
    if( 2 % 2 === 0){
  return true;
    }
    else{
        return false;
    }
};


#2

the syntax for checking if a number is even is if (number % 2 == 0)

If you're still a bit confused: https://simple.wikipedia.org/wiki/Even_number :slight_smile:


#3

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