Answers for "'return await promise' vs 'return promise' in JavaScript"

0

'return await promise' vs 'return promise' in JavaScript

if the promises successfully resolve, there isn’t a big difference 
 between using return await promise and return promise.

However, if you want to catch the rejected promise you’re returning
from an asynchronous function,
then you should definitely use return await promise expression 
and add deliberately the await.

catch(error) {...} statement catches only awaited rejected promises
in try {...} statement.

demos in source url
Posted by: Guest on August-30-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language