1 | async function sleep(millis) { |
Here a better (by meaning not by look) name for resolve
would be setPromiseStatusToResolvedAndSetValueTo
.
Note that the function passed into the new Promise
constructor gets immediately executed synchronously. The special thing about Promise
is when it gets “handled”, not when it gets created.