Return-Outside-Function
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.
Sourcery rule id: return-outside-function
Section titled “Sourcery rule id: return-outside-function”Description
Section titled “Description”Cannot use return outside a function definition
returnExplanation
Section titled “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