Review of Functions in JavaScript
Defining a function

In JavaScript a function can be defined by preceding a bunch of code with the word function followed by its inputs.

The inputs are known as parameters and are enclosed with (). The associated code is enclosed with {}.

In the editor you will see the beginnings of a definition for a cube function.


Complete the cube function and use it to calculate the cube of 7. Use the square function as a reference on how to do this.

Stuck? Get a hint! Hint
Get live, fast support from Codecademy Advisors when you get stuck. Learn more.

If you've forgotten, the cube of a number is equal to the number multiplied by itself 3 times.

For example, the cube of 5 is 5 * 5 * 5, or 125 in other words. Modify the cube function to accept the input x and return its cube.