#1. if/else


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

It is supposed to return true when the number is evenly divisible by 2 which it is`
I get the error message saying that function returns false when divided by 3
what am I doing wrong?



Please read here how a function should be declared and than look at your code :slight_smile:



your code is right except the first line. it first line should be :
var isEven = function(number) {


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


Looks like your function returns false when number = 3. Check whether your code inside the if/else statement correctly returns true if the number it receives is odd.

Please help, what did I miss?


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