0 jaggy posted SyntaxError: await is only valid in async functions and async generators function AsyncCall() { let promise = Promise.resolve(1); let result = await promise; } AsyncCall(); SyntaxError: await is only valid in async functions and async generators TypeError: AsyncCall is not a function[Learn More] Edit Question
0 angeo answered Nov 30 '-1 00:00 right way is put async before function . async function AsyncCall() { let promise = Promise.resolve(1); let result = await promise; } AsyncCall(); await only works inside async function. Edit Answer