Searching evens


#1


https://www.codecademy.com/courses/javascript-beginner-en-qDwp0/0/1?curriculum_id=506324b3a7dffd00020bf661#
how do you do this lesson?

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


#2

the problem is in your if statement, right now you are checking if a number devided by two has a remainder of that same number devided by two's remainder. instead of using the isEven variable create a variable above the function called number and set it to a number value, and then use number %2 === 0 inside the if statement. this should work.


#3

So thats it! Thank you dude!


#4

Can you send an example?


#5

so it would look like
if(number %2 === 0){

}


#6

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

how's this?


#7

this might work, call the function with a number and see what happens. do you know how to call the function with a number?


#8

by replacing the (number) with an actual number in the ( ) ?


#9

no, in order to call the function you type the name of the function "isEven" and parenthesis like this
isEven();
in order to give it a number you just put a number inside the parenthesis.
isEven(4);
you call the function at the end of your code


#10

Oh. Makes sense. Thank you dude!


#11

no problem, did it work? if so click the solved button next to the post that answer the question so people know that you don't need more help.


#12

One more thing.

var isEven = function(number) {
// Your code goes here!
if(isEven%2===0){
return true;
} else {
return false;
} else if {
isNaN(NaN)=true;
console.log("That's not a number...");
}
};
isEven(4)

It's telling me that there's an unidentified keyword 'even'

Where is it?


#13

i don't see it but try putting a semicolon at the end of the isEven(4)


#14