How to execute async functions in VSCode debugger?

If I drop into the VSCode debugger in some javascript code and call an asynchronous function it just returns a promise. How can I resolve the promise within the debugger so I can see what the result is?

2 answers

  • answered 2020-11-25 01:29 spaxxUnited

    Maybe put an "await" in front of the function call?

  • answered 2020-11-25 01:41 wuliu

    You can do it like this:

    const result = await Promise.resolve("success");

    And then run debugger in VSCode.