return
return – Specifies the value to be returned by a function.
Description
return [mixed variable]
Parameters
Name | Description | Type | Default | Optional |
---|---|---|---|---|
variable | The value to be returned. | mixed | Yes |
Examples
Example #1 – return example
Return a value
Example #2 – return example
If no parameter is passed to return, the result will be equal to undefined.
Example #3 – return example
Return canbe used to exit a function at any point, and the rest of the code will not be executed.