Hi guys i'm stuck!


#1



// Define quarter here.





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


#2

What error message are you getting? Also, I don't see where you defined the function quarter.


#3

Yeah i've reset the code, because i typed every possible code i could think of, please can you do it for me so i could see what mistake i made?

sorry for my bad English

thanks


#4

here is what i've tried
..;

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

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

...


#5

I can't do it for you, but I'll guide you through it.
So you know that you need to define the function quarter. How do you create a function? The syntax is

var functionName = function(parameters) {

}

or, its

function functionName(parameters) {

}

Can you write the function quarter for me based on this?


#6

It asks you to return number/4


#7

i'm getting this error:

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

#8

then after you applied @kyleaw suggestion, lets look at your if statement:

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

in this if statement, you call the function:

quarter()

but since the function you call has a parameter, at the function call you should supply an argument:

quarter(argument)

the argument you pass into the function call should be a number which after being divided by 4, is divisible by 3.


#9

Nice answer! Thank you for replying, I was cooking. :slight_smile:


#10

your answers was also really good :slight_smile: No problem


#11

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