What's wrong with my code?


#1

reference error because i didn't call the function. how did i not call it?

var isEven = function(number) {
  // Your code goes here!
  if(isEven % 2 = 0){
      return true
  } else if {
      (isNaN(number)) {
          return "that ai'nt no numba"
  } else {
      return false
}
isEven(1)


#2

isEven is a function object, not a number.

Comparisons use the === operator (identity).

if (number % 2 === 0) {

} ...

#3

it's returning "is even is not defined"


#4

`
else if ( ... ) {


#5

still returning a reference error


#6

var isEven = function(number) {
    if (number % 2 === 0){
        return true
    } 
    else if (isNaN(number)) {
        return "that ai'nt no numba"
    } else {
        return false
    }    // <<< this was missing
};

isEven(1)

#7

still returning a reference error


#8

Please post your code. Thanks. Include a link to the exercise, as well.


#9

Write an if / else statement inside the isEven function. It should return true; if the number it receives is evenly divisible by 2. Otherwise (else), it should return false;.

Make sure to return - don't use console.log()!\

var isEven = function(number) {
// Your code goes here!
if (number% 2 = 0){
return true
} else if (isNaN(number)) {
return "that ai'nt no numba"
} else {
return false
}
};
isEven(1)


#10

Needs to be a comparison, === in order to be a conditional expression.


#11

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