Did you remember to call quarter() inside the if statement with a value that would cause it to print 'The statement is true'?



// Define quarter here.
var quarter = function (number)
    return number/4;

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


Below is the text from the hint given at the end of the instructions:

"Recall % is modulo. It gives you the remainder when one number is divided by another.
eg. 13 % 3 is 1.

We want quarter(some number) that when divided by 3 has remainder 0."

The number you supply your quarter function with won't evaluate to a remainder of 0. Select a different number.


you give some no. by yourself?


Here, quarter is given 6. Meaning your function will take 6 and divide it by 4. Then you divide it by 3, giving you 0.5. This is the remainder. This triggers the else statement. You want to give quarter a number that gets divided by 4, then by 3 and results in no remainder. A remainder of 0 triggers your if statement.


If you are a hands on sort of person, you can always ask your program what it is doing. Here you can change the test number to see the effect https://repl.it/C3c5/0


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