I am currently follwing the Graceful asynchronous programming with Promises chapter.
I have reached the step about multiple promises and there is a little point that I do not understand.
My question is about the following code :
I do not understand what is the role of the return keyword (in line 2) before the fetch call. What would it change if the return keyword was not there? It is explained later but I still don’t get it :
Second, we have added the
returnkeyword before the
fetch()call. The effect this has is to run the entire chain and then run the final result (i.e. the promise returned by
text()) as the return value of the function we’ve just defined. In effect, the
returnstatements pass the results back up the chain to the top.
Thanks for your help,
Have a nice day