Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

async function javascript

//Async function (JAVASCRIPT)
//async function have 1 main purpose:

//Being able to use 'await' in a function
function example() {
return await fetch('https://mysite.com/api'); //error
}

async function smartexample() {
return await fetch('https://mysite.com/api'); //mhmm!
}
Source by github.com #
 
PREVIOUS NEXT
Tagged: #async #function #javascript
ADD COMMENT
Topic
Name
7+1 =