Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

196
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda