What is the output of the following? async function foo() { return 42; } console.log(foo());

JavaScript Developer Medium

JavaScript Developer — Medium

What is the output of the following? async function foo() { return 42; } console.log(foo());

Key points

  • The async function foo() returns a Promise object.
  • The value 42 is wrapped inside the Promise object.
  • The console.log() statement displays the Promise object with the value 42.

Ready to go further?

Related questions