#8 - Functions, return and if/else - weird error message


#1



So for this exercise, I understand the functions themselves and the math principles involved. I think I'm putting in the right type of number - something that, after being divided by 4, is evenly divisible by 3.

60 fits that bill (60 / 4 =15, 15 / 3 = 5 with remainder zero as per the modulo)


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

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

However, the error message wants me to come up with a result of -25 when this is listed nowhere in the instructions. Screenshot below.


#2

your quarter function doesn't return anything


#3

It's listed in a more general sense, it describes what your function should do with the argument it receives


#5

Thank you, I added the return keyword in the right line and it works now. I just don't get why it would list those numbers specifically in the error message - in most of the other tutorials I've done so far, if they want a specific number as a result, the error message will say so.


#6

the exercise just test a bunch of numbers to make sure your functions work right, this was the first number it encountered where it had a problem


#7

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