> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sourcery.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Return-Outside-Function

#### Sourcery rule id: `return-outside-function`

#### Description

Cannot use `return` outside a function definition


#### Match

```javascript
return
```



#### Explanation

The `return` statement ends function execution and specifies a value to be returned to the function caller.
If `return` is used outside a function definition it will throw a `SyntaxError`.

However in a node.js script a `return` statement is allowed outside a function as node.js
scripts are wrapped in a module function - https://nodejs.org/api/modules.html#modules_the_module_wrapper
