8. Functions, return and if/else | i'm stuck a bit


#1

Hello!

I’m stuck and need some help pls. I made a function called ‘quarter’ and give this function a parameter (12).
So, the ‘quarter’ function divide 12 with 4 and give a return value 3.
And i think 3 % 3 === 0, but as the error message said, something wrong. :smiley:

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

Error:
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’?

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

quarter(12);

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

#2

look:

quarter(12);

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

in the if statement, you don’t give an argument to calling quarter. The function call should be in the if condition, and correct so the condition evaluate to true


#3

Oh! It’s makes sense now. Thanks a lot!


#4