8. Functions, return and if / else


#1



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


Now, I am a 'noob' to JavaScript so this is maybe the reason why I am struggling, When I input this code it comes up with 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'? but I do not know where to call quater()!!! Please help!?!?


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





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


#2

Your function takes an argument, do you give it one?
The way you'd have found this yourself is by picking apart the condition and printing out its components to see what happened and then look closer at the part that acted differently from what you expected


#3

Well, I really do not know what to put in as a argument.


#4

You'll have to ask yourself what you mean for your code to do. Without that you're completely aimless and no knowledge of programming can help you.


#5

Got It! :grinning:

Found out that you have to replace the (quarter() with a random number to make the statement true!

Thanks for your help.


#6

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