Functions, return and if / else


#1

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

I keep getting this same error message, but I do call out quarter in the if statement. Thank you for your help.

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


Replace this line with your code.


#2

Please post your code


#3

Here is the code I used. Thank you.

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

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


#4

place an argument in your function call here,

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

i.e

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

that way you don't need this function call,


#5

Great! Thank you. That fixed the issue.


#6

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