I’m stuck could you help me please!


#1

[https://www.codecademy.com/en/courses/javascript-beginner-en-6LzGd/1/3?curriculum_id=506324b3a7dffd00020bf661](https://www.codecademy.com/en/courses/javascript-beginner-en-6LzGd/1/3

I’m stuck could you help me please!!


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

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.

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,

quarter(24)

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


#4

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