If I try in Google Chrome's dev tool:
fn = async () => {
await new Promise((res) => setTimeout(res, 3000));
return 123;
};
fn.constructor // => ƒ AsyncFunction() { [native code] }
fn.__proto__.__proto__ === Function.prototype // => true
AsyncFunction // => Uncaught ReferenceError: AsyncFunction is not defined
From the above, it seems fn
is an AsyncFunction
instance, and AsyncFunction
"is-a" Function
, but AsyncFunction
doesn't exist.
How can this be understood? (and what class does fn
belong to?)