Stuck on 21. Modulo if/else, it says it evaluates to false and I don't know what's wrong, help?


#1


//I seriously don't know what's wrong, the hint says the same solution I inputted on the if statement
//so I have no idea what I'm missing
if (console.log(10 % 2 === 0))
{
    console.log("The first number is even");
} 
else {
    console.log("The first number is odd");
}


#2

why do you use console.log() inside a if condition? It doesn't seem very logic, and it tricks the error message


#3

console.log returns undefined, so your if condition is the same as:

if (undefined)

Since undefined is falsy, that is the same as saying:

if (false)

That is why you are seeing "The first number is odd" statement logged.


#4

Oh my god I really didn't notice that, it completely went over my head. Thank you so much!


#5