AbdulElahGwaith's picture
Upload folder using huggingface_hub
780c9fe verified
metadata
title: AsyncFunction
slug: Web/JavaScript/Reference/Global_Objects/AsyncFunction
page-type: javascript-class
browser-compat: javascript.builtins.AsyncFunction
sidebar: jsref

The AsyncFunction object provides methods for async functions. In JavaScript, every async function is actually an AsyncFunction object.

Note that AsyncFunction is not a global object. It can be obtained with the following code:

const AsyncFunction = async function () {}.constructor;

AsyncFunction is a subclass of {{jsxref("Function")}}.

Constructor

  • {{jsxref("AsyncFunction/AsyncFunction", "AsyncFunction()")}}
    • : Creates a new AsyncFunction object.

Instance properties

Also inherits instance properties from its parent {{jsxref("Function")}}.

These properties are defined on AsyncFunction.prototype and shared by all AsyncFunction instances.

  • {{jsxref("Object/constructor", "AsyncFunction.prototype.constructor")}}
    • : The constructor function that created the instance object. For AsyncFunction instances, the initial value is the {{jsxref("AsyncFunction/AsyncFunction", "AsyncFunction")}} constructor.
  • AsyncFunction.prototype[Symbol.toStringTag]
    • : The initial value of the [Symbol.toStringTag] property is the string "AsyncFunction". This property is used in {{jsxref("Object.prototype.toString()")}}.

AsyncFunction instances do not have the prototype property.

Instance methods

Inherits instance methods from its parent {{jsxref("Function")}}.

Specifications

{{Specifications}}

Browser compatibility

{{Compat}}

See also