Snif... What am I doing wrong?



Here is my code:

var isEven = function(number) {

var typenombre=isNaN(number);

    var nombre= number%2;
         return true;
    else {
     return false;  

else if(typenombre==='true'){
    return 'Merci dentrer un nombre';


It says: Oops, try again. Your function returns false for 2!...

What am I doing wrong? Thanks!


you need to out something in your last 'else' statement ; you put %2 to get false


My last else wouldl not out anything. Typenombre can only be true or false.


you need three equation signs, not two


two are actually ok 2 compare the value and 3 compare value and type.


hum... So no idea why it is wrong?


First of all else is not mandatory so if you don't need the else case just omit it. And the other thing is that your parameter is named number but in the progress you mostly use nombre.


Hum. Basically, you don't know why it is not working?


... Sry completely missed that one ... :blush:
Next guess would be that typenombre is a boolean meaning true or false and not "true" or "false".


in your if statement checks you need to put false and true without quotation marks. You turned booleans into strings.