2. If / else if / else What is the unexpected?


#1


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


I've rechecked my code a couple of times, but I don't see how I get the error:

SyntaxError: Unexpected token {

I tried reloading, but it didn't help.


var isEven = function(number) {
    if (number % 2 === 0) {
        return true;
    } else if {
        if (isNaN(number) === true) {
            return "The text you provided was not a number.";
        };
    } else {
        return false;
    };
};


#2

Hi @anoniemand ,

if always requires a condition, but you did not specify a condition on this line ...

} else if {

#3

I keep making the same dumb mistakes again, again and again... Thanks!


#4

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