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)