Open utterances-bot opened 2 years ago
Marvellous
As always nice post Dmitri!
Wonderful simplification.
Thanks for the very good explanation..:)
As always nice post Dmitri!
Thanks @salesh!
Thanks for the very good explanation..:)
You're welcome @popiang!
Thank you for another fantastic article! Just wondering if anyone has an answer to the "challenge" at the bottom of the article?
promise.then(fn1, fn2) promise.then(fn1).catch(fn2)
The second variant will process a reject result of fn1, if any, while the first one won't.
Very clear and very well written, Dimitri. Thanks a lot.
Very clear and very well written, Dimitri. Thanks a lot.
You're welcome Paulo @pboto!
Thanks a lot Dimitri, for this great explanation!
Thanks a lot Dimitri, for this great explanation!
@AlexandreSherozia Glad you like it Alexandre!
4.1 await-ing promise value
resolve has missing closing ')' bracket
function getList() {
return new Promise(resolve => {
setTimeout(() => resolve(['Joker', 'Batman'], 1000);
});
}
it should be
function getList() {
return new Promise(resolve => {
setTimeout(() => resolve(['Joker', 'Batman']), 1000);
});
}
Just as an alternative to times you want to 'fake' a delay... you can do a syntax like this
function getList() {
return new Promise(resolve => setTimeout(resolve, 1000, ['Joker', 'Batman']));
}
Any arguments passed into setTimout after the duration becomes arguments for the settimeout callback
Just as an alternative to times you want to 'fake' a delay... you can do a syntax like this
function getList() { return new Promise(resolve => setTimeout(resolve, 1000, ['Joker', 'Batman'])); }
Any arguments passed into setTimout after the duration becomes arguments for the settimeout callback
Good idea @WORMSS! Thanks for sharing.
4.1 await-ing promise value resolve has missing closing ')' bracket
Thanks @shivam3596. Fixed.
amazing !
@annasudol Thanks!
What is a Promise in JavaScript?
The post that I had wanted to read myself to understand promises.
https://dmitripavlutin.com/what-is-javascript-promise/