Functions in JavaScript

Functions often define a process that receives inputs and use it to compute an output.

Functions will usually use their arguments to compute a value which will become the result from the function call.

The important part of this exercise is to learn about return. The return keyword is used inside a function to return a value when a function is called.

As an example, in math, the identity function is a function that always returns the same value that was used as its argument. Remember the argument is just a specific value of the parameters.


Call the identity function, passing in a number. What is the output?

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

To call a function, we write the function name followed by a pair of parenthesis. (eg. functionName( ). We can pass arguments to the function. (eg. functionName(1))