Return inconsistent behavior


#1


Why does the first code below work, but the second doesn't?

var quarter = function (number) {
return number/4;
};

if (quarter(12) % 3 === 0 ) {
  console.log("The statement is true");
} else {
  console.log("The statement is false");
}
------------------------------------------------------------

var quarter = function (number) {
return number/9;
};

if (quarter(27) % 3 === 0 ) {
  console.log("The statement is true");
} else {
  console.log("The statement is false");
}


Error message: Hmm, it looks like your quarter function doesn't return -25 for -100.


#2

because you divide by 9:

return number/9;

instead of 4


#3

Well, 27 / 9 = 3, isn't it supposed to work this way?


#4

yes, so "the statement is true" should show in the console, but that is not how SCT works (submission correctness test), the checking script if you like, it want you to divide by 4, not by 9


#5

Thank you stetim94 :smiley: