Another way to create and resolve promises is to use the async… await syntax. Async is basically syntactical sugar around the Promise class. The dataPromise promise we defined earlier with the Promise class can be defined with async as follows:
async dataPromise() {
return "some important data!";
}Rejections can also be defined simply by throwing errors within the async function:
async dataPromise() {
throw new Error('data failure');
}