Consider this situation.
new Promise(function(resolve, reject) { var x = resolve(2); });
What is the value of x ? I tried to print it and it showed me undefined . This is intuitive, but is it always so? Is it in the docs?
Second question
new Promise(function(resolve, reject) { resolve(2); return 5; });
What should we return from the function that we put in the promise? Is this value ignored?
javascript promise return-value
MichaΕ Kownacki
source share