More control flow in java script lesson 2


This is my code I don't know why it isn't working

var isEven = function(number) {

if(number % 2 === 0) {
return true;
else if (isNaN(number)) {
return "This is not a number";
else {
return false;



i would first check if the input is a number (isNaN), so "switch" your if and else if statement


Of course @stetim94 is correct that it would improve your function if you check for not a number first as it makes much more sense. But from what I can see this should already be working, did you try to refresh the page? What kind of error message do you get?


put your true and false value into a pair of " ( ) "


not necessary return is a keyword not a function call.