Intro to function Javascript


#1



Oops, try again. There was a problem with your syntax.
SyntaxError: Unexpected end of input


var quarter = function(number) {



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


#2

your function:

var quarter = function(number) {

the { of your function has no matching }


#3

var quarter = function(number)

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

Oops, try again. There was a problem with your syntax.


#4

you are then suppose to add }, not remove {


#5

var quarter = function(number) {}

if (quarter(6) % 3 === 0 ) {
console.log("The statement is true");
} else {
console.log("The statement is false");
}
Oops, try again. Hmm, it looks like your quarter function doesn't return -25 for -100.


#6

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

if (quarter(13) % 3 === 0 ) {
console.log("The statement is true");
} else {
console.log("The statement is false");
}
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'?


#7

here:

quarter(13)

you should have a number which after being divided by 4 is divisible by 3


#8

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