Sitelet https://github.com/nodejs/node/issues/36236
Skip to content

to delete #36236

Description

@cojack

delete this please

Activity

  1. changed the title [-]return vs assigment and return[/-] [+]to delete[/+] on Nov 23, 2020
  2. aduh95 commented on Nov 23, 2020

    @aduh95
    Contributor

    This is not Node.js specific, it's just how JavaScript works. FYI, if you add an await in your return statement:

    async function foo() {
        throw new Error('Foo');
    }
    
    async function bar() {
        try {
            return await foo();
        } catch (e) {
            return 2;
        }
    }
    
    (async () => {
        const d = await bar();
        console.log(d);
    })();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions