If/else


#1

error reading (illegal return statement)

what am I doing wrong!

var isEven = function(number) {
  // Your code goes here!
  
};
if(number%2===0){
    return ("true");
}else{
    return ("false");
}
};
isEven(3)


#2

Your code was supposed to go in there but since you decided not to put it in there remove the bracket and semi colon after the one line comment. Your code should work after that. :slight_smile:


#3

I reset the code so that I could fix my crazy mistake and it still wont pass!

var isEven = function(number) {
if(number%2===0){
return ("true");
}else{
return ("false");
}
};
isEven(3)


#4

@blogsurfer47453 a return statement syntax is like this:

return true;

not like that.

Also the code is supposed to return true. But all you have to do there is change this:

to this:

isEven(10);

hope this helps

Steven


#5

thank you so much!!!!


#6

You actually don't really need to call the function in this exercise. Sorry for nitpicking, though.


#7

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