Doubt in chp.9


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

Will somebody tell me what correction should be done in this code?



if(isEven % 2)

you should check if the remainder of number (the function parameter) equals zero.

This way, you can pass any value into the function call as argument to check if the number is even/odd


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