Functions, return if/else


I don't know what to do with this code:

// Define quarter here.

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

Here are the instructions:
Define a function called quarter which has a parameter called number.
02. This function returns a value equal to one quarter of the parameter. (i.e. number / 4;)
03. Call the function inside the if statement's condition (and put in a parameter value!) such that "The statement is true" is printed to the console.


To define a function called quarter has one parameter called (number) you must write:

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

before you call it inside the if statement's condition.


ok i'll try that :grin:


thank you for your help


you're welcome :smiley:


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