14.10 The return Statement
Syntax
A return statement causes a function to cease execution and, in most cases, returns a value to the caller. If return statement may not actually return a value to the caller depending on surrounding context. For example, in a try block, a return statement's finally block.
14.10.1 Runtime Semantics: Evaluation
- Return
Completion Record { [[Type]]:return , [[Value]]:undefined , [[Target]]:empty }.
- Let exprRef be ?
Evaluation ofExpression . - Let exprValue be ?
GetValue (exprRef). - If
GetGeneratorKind () isasync , set exprValue to ?Await (exprValue). - Return
Completion Record { [[Type]]:return , [[Value]]: exprValue, [[Target]]:empty }.