I’m stuck could you help me please!



I’m stuck could you help me please!!

Java Script - 8. Functions, return and if / else


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.

The first step will be to block out the function syntax…

var quarter = function (number) {


The name of the function is quarter and the parameter is number. To return one quarter of the parameter, divide it by 4.

    return number / 4;

A call to the function will look like,


I’ll leave you to piece this together and write the required if statement.


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