DEV Community


Calling an async function without await

Mehul Lakhanpal
Full stack Developer | Micro-blogging on Web Development at | Creator of File Ops, Note Box, GitHub Marker
Originally published at ・1 min read
const asyncFunction = async () => "HELLO";

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

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

Enter fullscreen mode Exit fullscreen mode

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

Thanks for reading πŸ’™

Follow for more.

Instagram ● Twitter ● Facebook

Micro-Learning ● Web Development ● Javascript ● MERN stack


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

Discussion (0)