Here are the instructions....
When we call a function, its return value is just the result from running the function. That value can then be used just like any other value in JavaScript!
Look at the if statement starting on line 7. The if statement is checking whether the result of calling the function named quarter is divisible by 3.
Instructions
// Define quarter here.
if (quarter() % 3 === 0 ) {
console.log("The statement is true");
} else {
console.log("The statement is false");
}
Here is the code I applied and it comes up error message when I compile it. What am I missing?
// Define quarter here.
function quarter(number)
if (quarter(12) % 3 === 0 ) {
return number/4
console.log("The statement is true");
} else {
console.log("The statement is false");
}
When we call a function, its return value is just the result from running the function. That value can then be used just like any other value in JavaScript!
Look at the if statement starting on line 7. The if statement is checking whether the result of calling the function named quarter is divisible by 3.
Instructions
- Define a function called quarter which has a parameter called number.
- This function returns a value equal to one quarter of the parameter. (i.e. number / 4
- 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.
// Define quarter here.
if (quarter() % 3 === 0 ) {
console.log("The statement is true");
} else {
console.log("The statement is false");
}
Here is the code I applied and it comes up error message when I compile it. What am I missing?
// Define quarter here.
function quarter(number)
if (quarter(12) % 3 === 0 ) {
return number/4
console.log("The statement is true");
} else {
console.log("The statement is false");
}