async function (){
// await somthing
}
Uncaught SyntaxError: Unexpected token (
but i can define normal function like
function (){
// ...
}()
async function (){
// await somthing
}
Uncaught SyntaxError: Unexpected token (
but i can define normal function like
function (){
// ...
}()
You need a function name for this syntax :
async function functionName(){
// await somthing
}
You can use this syntax too if you don't want to name it :
async () => {
//await something
}
define an [anonymous] function and call immediately,parentheses needed
(async function (){
return 1
}) () // and call it , Promise {<resolved>: 1}