Explained Asyn/Await with Rest api including examples in JavaScript, please go through it understand the concept.
Syntax:
async function myDisplay() {
let myPromise = new Promise(function(resolve, reject) {
resolve("I love You !!");
});
document.getElementById("demo").innerHTML = await myPromise;
}
myDisplay();