Functions, Return and If/Else


I am doing the code like this,
// Define quarter here.
var quarter = function(number)

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

but every time I press submit, it says, "syntax error: unexpected token if"

Please help!!!


You have to give the function something to do. Code to execute.
Your if statement is looking for a return from the function that isn't there.
Like this:

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


Thank you for your help. I understand it better now!!!


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