Cytat
1. Define a function called quarter which has a parameter called number.
2. This function returns a value equal to one quarter of the parameter. (i.e. number / 4)
3. Call the function inside the if statement's condition (and put in a parameter value!) such that "The statement is true" is printed to the console.
2. This function returns a value equal to one quarter of the parameter. (i.e. number / 4)
3. Call the function inside the if statement's condition (and put in a parameter value!) such that "The statement is true" is printed to the console.
Napisałem taki kod:
Cytat
var quarter = function(number) {
return number / 4;
};
if (quarter(12) % 4 === 3 ) {
console.log("The statement is true");
} else {
console.log("The statement is false");
}
return number / 4;
};
if (quarter(12) % 4 === 3 ) {
console.log("The statement is true");
} else {
console.log("The statement is false");
}
Pojawia mi się błąd:
Cytat
TypeError: Property 'quarter' of object [object Object] is not a function
Ma ktoś jakiś pomysł?