Currently there is no perfect solution for that, but it can be done using eval
:
let isAsyncSupported;
try {
isAsyncSupported = eval(`typeof Object.getPrototypeOf(async function() {}).constructor === 'function'`);
} catch (exception) {
isAsyncSupported = false;
}
For more see:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/AsyncFunction
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function