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 Function.
Constructor
- AsyncFunction()
- : Creates a new
AsyncFunctionobject.
- : Creates a new
Instance properties
Also inherits instance properties from its parent Function.
These properties are defined on AsyncFunction.prototype and shared by all AsyncFunction instances.
- AsyncFunction.prototype.constructor
- : The constructor function that created the instance object. For
AsyncFunctioninstances, the initial value is the AsyncFunction constructor.
- : The constructor function that created the instance object. For
AsyncFunction.prototype[@@toStringTag]- : The initial value of the
@@toStringTagproperty is the string"AsyncFunction". This property is used in Object.prototype.toString.
- : The initial value of the
Note:
AsyncFunctioninstances do not have theprototypeproperty.
Instance methods
Inherits instance methods from its parent Function.