AsyncFunction
BaselineWidely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since April 2017.
TheAsyncFunction
object provides methods forasync functions. In JavaScript, every async function is actually anAsyncFunction
object.
Note thatAsyncFunction
isnot a global object. It can be obtained with the following code:
const AsyncFunction = async function () {}.constructor;
AsyncFunction
is a subclass ofFunction
.
Constructor
AsyncFunction()
Creates a new
AsyncFunction
object.
Instance properties
Also inherits instance properties from its parentFunction
.
These properties are defined onAsyncFunction.prototype
and shared by allAsyncFunction
instances.
AsyncFunction.prototype.constructor
The constructor function that created the instance object. For
AsyncFunction
instances, the initial value is theAsyncFunction
constructor.AsyncFunction.prototype[Symbol.toStringTag]
The initial value of the
[Symbol.toStringTag]
property is the string"AsyncFunction"
. This property is used inObject.prototype.toString()
.
Note:AsyncFunction
instances do not have theprototype
property.
Instance methods
Inherits instance methods from its parentFunction
.
Specifications
Specification |
---|
ECMAScript® 2026 Language Specification # sec-async-function-objects |