Function, return, and if and else


#1


8 introduction to functions in javascript


"there was a problem wiht your syntax"

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

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


#2

this line:

var quarter = function(number);

the semi-colon there is wrong

and this line:

return ((number / 4);

the opening (() and closing (() don't match (2 opening, one closnig)


#3

what is the problem with this code??
var quarter=function(number){
return (number/4);
}
if (quarter(27) % 3 === 0 ) {
console.log("The statement is true");
} else {
console.log("The statement is false");
}


#4

the if condition should evaluate to true, in your case it evaluates to false.


#5

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