# 8. Functions, Return and If / Else

<PLEASE USE THE FOLLOWING TEMPLATE TO HELP YOU CREATE A GREAT POST!>

<Below this line, add a link to the EXACT exercise that you are stuck at.>
https://www.codecademy.com/courses/javascript-beginner-en-6LzGd/1/3?curriculum_id=506324b3a7dffd00020bf661

<In what way does your code behave incorrectly? Include ALL error messages.>
it says that quarter is not defined and i’m not quite sure how to fix it

```

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

if (quater(3) % 3 === 0 ) {
console.log(“The statement is true”);
} else {
console.log(“The statement is false”);
}

``<do not remove the three backticks above>``

HI they aske you to declare a function name quarter

I have tried removing the dollar at the end of quarter and it still doesn’t work

can you post your new code?

var quater = function (number) {
return quater / 4;
};

if (quater(27) % 3 === 0 ) {
console.log(“The statement is true”);
} else {
console.log(“The statement is false”);
}

its in the post above this one

1 Like

This line

``````return quarter / 4;
``````

you should change the quarter with number which is the argument of the function…
Then here

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

you should put number that can be divide by 4 and 3

They also ask you to create a function called `quarter` instead of the one you created, named `quater`.

1 Like

For Fun:

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”);
}

1 Like

Right Thank you Its work

This is my code. It works but there is a Range error. I would like to know what it exactly means.

var quarter = function(number) {

return quarter(number)/ 4;
}

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

HI inside the function quarter you should return …return number / 4

if (quater(27) % 3 === 0 )
it has to be 24 not 27

HI 12 is fine too

Could I receive some help on why I would be receiving an error on this code below? Thank you

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”);
}

The “;” after your parameter but before your opening curly bracket is incorrect.

Your code listed:
var quarter = function(number); {

Should be:
var quarter = function(number) {

Thanks mlw253. Now I’m getting a message that says I didn’t define the quarter function. Below is my current code:

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

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

HI this line

``````return quarter= number/4;
``````

you should remove the quarter =

A post was split to a new topic: There’s a problem in this exercise!

2 posts were split to a new topic: Not seeing my mistake