Skip to content
Advertisement

new to js – understanding async await syntax

I am attempting a basic concept that is still eluding me… In the option (that is commented out) including the Start().then… I’m able to nest the functions so that they start and end in the desired order. In the await version, they start & end in the appropriate order but I’m not clear how I’m meant to put in log the resolve text after each one has completed. Sorry this is basic…

JavaScript

Advertisement

Answer

Well, you almost have it. In an async function, the await will return the result of the promise. So all you have to do is do the console.log after.

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement