JavaScript & jQuery Tutorials

JS Home Right Arrow JS Reference Right Arrow return

return statement

Value returned from a function.


Specifies an expression to be returned from a function.

If no return expression is declared the function will return undefined.


Signature Description
return [expression];Specifies an expression to be returned from a function.


Parameter Description
expressionAn optional expression to be returned from the function.


The code below gives an example of using the return statement.

// Create a function statement that takes an argument and returns square of the argument.
function squareNumber(a) {
  return a * a;

Press the button below to action the above code:

Related Tutorials

JavaScript Intermediate Tutorials - Lesson 8 - Functions


go to home page Homepage go to top of page Top