Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

197
Views
How do I define AsyncFunction in node?

I am trying to define an AsyncFunction (please note the big F) in node as described here:

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/AsyncFunction

But I get:

AsyncFunction('var1', 'var2', 'let test=var1+var2') (1, 2)
ReferenceError: AsyncFunction is not defined

Creating a normal Function object works fine. Does NodeJS not support AsyncFunction?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

I think the question you're fundamentally asking is what is the syntax for defining an asynchronous function, and not really trying to invoke the constructor of that object.

if so then:

synchronous:

function foo()

asynchronous:

async function bar()

Update: After understanding your comments, I encourage you to re-read the spec: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/AsyncFunction

It clearly describes that it is not a global-scope object. The examples listed below it as well, also describe it's usage which also reinforce the idea that it must be assigned (locally) before usage, so there is a definition of it.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!