Async Function Constructor

by ronilan

JavaScript

code = 'return 5'
const AsyncFunction = Object.getPrototypeOf(async () => {}).constructor;
let af = new AsyncFunction(code);
console.log(af)

let v = af.apply();
v.then((result) => {
  console.log(result)
});