Just a hobbyist programmer with an eye on new technologies. Currently helping Quasar and NestJS Frameworks, because....well.....because they're awesome! :-)
Correct me if I am wrong, but the console log with async/ await is only blocked, because the data variable is in it. If you had of done the same above with the .then example, that console log would be blocked too.
Or put another way, take out the data variable and the async/ await example won't block either.
Correct me if I am wrong, but the console log with async/ await is only blocked, because the
datavariable is in it. If you had of done the same above with the .then example, that console log would be blocked too.Or put another way, take out the
datavariable and the async/ await example won't block either.Scott
That's not true. Await will wait for the promise to be resolved or rejected before moving to the next line. Consider the following example:
It will produce:
Whether you use
responseor not, it will go line by line.I trust that this explanation has been helpful. If you have any further questions, please don't hesitate to ask.
Best regards!