Functions, return and if / else HELP!


#1


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


They say Oops Try again .. I don't what i'm doing wrong please help!


var quarter = function(number)
{return number/4};
var condition = function(quarter)
{
if (quarter(12) % 3 === 0 ) {
  console.log("The statement is true");
} else {
  console.log("The statement is false");
}};


#2

Why do you create an additionnal function with parameter "quarter" ?

And then, you call quarter in that function, so the param should be a function... And nowhere in your code you call your "condition" function. The solution is simpler; re-read the tasks and redo it step by steps.


#3

thank you very much!


#5

I need help. What's wrong with my my code:

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

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

}

console.log(quarter(12));


#6

the problem is from braces and parentheses. you need a closing parenthesis } after 4.
and you should remove the first open brace of the parameter ((number
and you should remove one parenthesis after console.log


#7

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