Do arrow functions with block bodies return implicitly?
No. An arrow with a block body (=> { ... }) needs an explicit return statement. Only an arrow with an expression body (=> expr) returns the expression implicitly.
Verify This Answer
Cross-check this information using these trusted sources:
More FAQs in How JavaScript Functions Return Values
undefined. If a function has no return, or a return with no expression, it returns undefined to the caller.
It evaluates the return expression, hands the value to the caller, and immediately pops the current frame from the call stack. Code after return in the function body is not executed.
Because the braces are interpreted as a block body, not an object literal. Wrapping the object in parentheses (n) => ({ x: 1 }) makes it an expression body that returns the object.
Still have questions?
Browse all our FAQs or reach out to our support team
