DEV Community

Mehul Lakhanpal
Mehul Lakhanpal

Posted on • Originally published at codedrops.tech

Calling an async function without await

const asyncFunction = async () => "HELLO";

const main = async () => {
  const value = asyncFunction();

  console.log(value === "HELLO" ? "true" : "false");
};

main();
Enter fullscreen mode Exit fullscreen mode

Output: false
asyncFunction() returns a promise not the resolved value.


Thanks for reading πŸ’™

Follow @codedrops.tech for more.

Instagram ● Twitter ● Facebook

Micro-Learning ● Web Development ● Javascript ● MERN stack

codedrops.tech


Projects

File Ops - A VS Code extension to easily tag/alias files & quick switch between files

Top comments (0)