Master de II. ULL. 1er cuatrimestre. 2020/2021
new Promise(executor);A function that is passed with the arguments resolve and reject.
The executor function is executed immediately by the Promise implementation,
passing resolve and reject functions
(the executor is called before the Promise constructor even returns the created object).
The resolve and reject functions, when called, resolve or reject the promise, respectively.
The executor normally initiates some asynchronous work, and then, once that completes, either calls the resolve function to resolve the promise or else rejects it if an error occurred.
If an error is thrown in the executor function, the promise is rejected.
The return value of the executor is ignored.