javascript-tutorial / en.javascript.info

Modern JavaScript Tutorial
https://javascript.info
Other
23.41k stars 3.85k forks source link

Inaccuracy in promise-basics page about .then/catch/finally call on settled promises #1067

Closed nexus3a closed 5 years ago

nexus3a commented 5 years ago

Dear Ilya! I am about "On settled promises handlers runs immediately" info box in https://javascript.info/promise-basics page. I read: "... if a promise has already settled, they execute immediately". I think, word "immediiately" is not good in this context because promise handlers will be executed later from microtasks queue (yours cources teached me, thank you :) ):

// an immediately resolved promise
let promise = new Promise(resolve => resolve("done!"));

promise.then(alert); // done! (shows up right now) - not exactly

alert("not too fast, i am first!");

I have not a big expirience in English, and I can't write a good phrase to describe a behavior .then/catch/finally handlers on settled promise. Possible, you should use "without waiting", "without delay" or something else, but not "immediately".

iliakan commented 5 years ago

I guess, if the person is not familiar with microtasks, these terms won't add up anything.