Functions & Variables


#1


Having some difficulties with exercise 8; 
// Define quarter here.
var quarter = function (number) {
    var quarter = number / 4;
    console.log(quarter);
};


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

CONSOLE DISPLAY
NaN
The statement is false
-25

Oops, try again. Hmm, it looks like your quarter function doesn't return -25 for -100.


#2

Since the outcome is expected to be true, then the argument passed to quarter() will have to be a multiple of the LCM of 3 and 4, namely one of,

0, 12, 24, 36, ... 12n

#3

Thanks, figured it out.


#4

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