2/14 If / else if / else


#1


What is wrong with my code? Please, help out. Thank you very much!

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

Oops, try again. Your function returns true for 3!


var isEven = function(number){
    if (number%2 === 0){
    return "This is an even number, good job."
    }
        else if (isNaN(isEven)) {
        return "This is not a number."
        }
    else{
    return "This is not an even number"
    }
}

var num = prompt("Type a number!");
isEven(num);


#2

"What is wrong" is super unspecific. Have you read the error message? What is preventing you from acting on what it says?


#3

You cant take your function as a condition


#4

IsNaN (number){return "Something";}


#5

thats the problem. You did read about a function called isNan but we dont have sucha function in the code so in the semicolon you should have the name of your function(isEven(number)===true).


#6

I think you have to put quotations around....isNaN("isEven"). isNaN is checking if whatever is in the bracket is a string or not. anything between quotations, is considered a string. Because you have isEven, which is the function itself, it's not going to work