Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

async and await

function delayResult() {
 return new Promise(resolve => {
   setTimeout(() => {
     resolve(‘Done’);
   }, 5000)
 })
}
async function getResult() {
 let result = await delayResult();
 return result;
}
getResult();
Source by developer.mozilla.org #
 
PREVIOUS NEXT
Tagged: #async #await
ADD COMMENT
Topic
Name
9+3 =