Do not understand what i am supposed to do


#1

these are the iNSTRuctions
Define a function called quarter which has a parameter called number.
This function returns a value equal to one quarter of the parameter. (i.e. number / 4;)
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.

this is the code

// Define quarter here.

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


#2

Well write a function with one parameter. That parameter is called number. Which should return the quarter of it's input. For example just return the number divided by 4. Now pick a number so that the function call makes the condition print the true statement. Maybe be a little more specific what you don't understand :slightly_smiling:


#3

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

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

this is what i got so far and i've got a syntax error i dont understand how to finish the code


#4

Not that bad. But the syntax for functions is:

var name = function(parameters){
   code
};

So get rid of the semicolon that separates the function from it body and close it.
Also what is that ]; at the very end supposed to do? If that is done you need to think what you need to insert in the () here:

if quarter() % 3 === 0 ) {

so that the:

console.log("The statement is true");

is executed.


#5

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

};

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

number(3);

this is the code now i dont understand what is needed to be done still


#6

if quarter(number) % 3 === 0 ) {

This line. First of all you missed the ( at the beginning of the else. And the other thing is that number is a local variable of your quarter function so it is not known outside. Instead what you should do is to pick a real number that fulfils the condition

(x/4)%3 ===0

pick a number for x so that this condition is true.


#7

I am a bit confused. If we are finding a quarter, shouldn't we be using %4 instead of %3? Why are we using %3?


#8

We're not finding a quarter we use the quarter function to get the quarter of a number and then we check if the result is divisible by 3.