# Function, returns, if and else is the real problem 8

#1

I have no idea at all what to write at all and nothing else is happening so please reply.

#2

Alright let's go back to basics,

We know that you're on lesson 8 "Functions, return and If / Else."

The instructions are as follows:

01. 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.

The hint is as follows:

This is a little tricky so let's take it slow. The code in the { } in the function should be
return number/4

On line 7, the if statement's condition calls the function! It needs you to put in number value.

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.

So now that we know all of that, what have you tried? Can you show us your code? What has you stumped about this lesson? Where are you confused?

Anything you can add to help us help you will narrow this down. I promise you it is frustrating when we have little or nothing to work with, so please add any details you can to make this easier for everyone.

#3

var quarter = function (number){

``return number/4;``

}
if (quarter(12) % 3 === 4){

``````console.log("the statement is true");
}
else{
console.log("the satement is false");
}``````

#4

what is wrong with this code

#5

"if (quarter(12) % 3 === 0 )" because 12/3 = 4,0 or just 4, so modulo is 0

#6

Sorry, (12/4)/3=3/3=0
I didn't include quarter, but the result is still 0, so you just put 0 instead of 10 and the statement will be true

#8

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

``return number/4``

}

if (quarter(12) % 3 === 0 ) {
console.log("The statement is true");
} else {
console.log("The statement is false");
}
ther thats my code it worked

#9

You should compare with 0, not 10