8. Functions return if/else. => SyntaxError: expected expression, got ';'


#1

Hi

I had a problem my code is:
// Define quarter here.
var quarter=function(number);
return number/4

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

and error
but i tried in different ways but can not find what is wrong..
Regards


#2

First, btw, you put your question in Java when it should be in Javascript. Secondly, your problem is you did not format correctly your var section. Instead of a semi colon use { } This should solve your synax error

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

Finally, and this is not necessary to passing the lesson but if you want a simplier way to answer in your if (quarter you can just put 13 in it instead of (72)% etc. So that would look like this at the end

if(guarter(13))

#3

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