tracks

Codecademy

Sign in Sign up
Ajax-loader-large-white
11/29
Functions in JavaScript
Introduction

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.

Instructions

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

?
Stuck? Get a hint! Hint

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))

script.js
Back to Editor

Sign in