8. Functions, Return and If / Else


#1



https://www.codecademy.com/courses/javascript-beginner-en-6LzGd/1/3?curriculum_id=506324b3a7dffd00020bf661


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


#2

HI they aske you to declare a function name quarter..


#3

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


#4

can you post your new code?


#5

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


#6

its in the post above this one


#8

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


#9

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


#10

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


#11

Right Thank you Its work


#12

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


#13

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


#14

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


#15

HI 12 is fine too


#16

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


#17

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) {


#18

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


#19

HI this line

return quarter= number/4;

you should remove the quarter =


#20

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


#22

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