loading...

Discussion on: Asynchronous Javascript - 04 - Promises

Collapse
ilya_sher_prog profile image
Ilya Sher

I thought that arguments and parameters were the same

You are welcome!

I used the word 'output' instead of 'result' because I didn't want the reader to confuse it with the 'result' property

I see. Not sure what would be best here. output can be confused with I/O.

Regarding the execution of the callbacks, I didn't mention about the condition you spoke of, because I wanted to keep this article simple without diving too much into the specifics.

I see... but this phrasing suggest that resolve() must happen after .then(...) is attached. This is incorrect.

functions do get added and piled into the call stack from the microtask queue.

I am not checking the source code but chances are call stack is used like in many other languages meaning it contains call frames (created by calling a function and removed by returning from a function) one on top of each other, not arbitrary unrelated code. This should be checked.

You're right about the random function. I was initially of the impression that the value returned is from 0 to 1, both exclusive. I shall correct that as well as the typo.

I would rewrite the random example because despite the 0 to 10 range, the chances of getting exactly zero are very slim. That's why code using random numbers typically floors and not ceils the numbers.

floating around on the Internet that can confuse beginners

Huge concern. Later, I need to work with these people.

But, you also need to understand, that as a beginner, everyone is bound to make mistakes.

That's optimistic. Not only as beginner.

senior devs like you to correct and guide the junior ones

In my perfect word, that happens somehow in an organized manner before publication to avoid people learning from possibly incorrect un-reviewed content. How realistic is that? Probably not that much.

discuss concepts on the web

Mmm.. discussion is fine but articles here are presented as information (I guess assumed by beginners to be correct), not as discussion.

harsh on newbies

Just making it clear: nothing particular against newbies :) Just correctness. You can see I opened issues on GitHub for Rust book and C++ documentation at Microsoft. I have no idea who did that but probably not beginners.

Thread Thread
ilya_sher_prog profile image
Ilya Sher

I am not checking the source code

Did check. It had reference to html.spec.whatwg.org/multipage/web...

The relevant part is:


While the event loop's microtask queue is not empty:

  • Let oldestMicrotask be the result of dequeuing from the event loop's microtask queue.
  • Set the event loop's currently running task to oldestMicrotask.
  • Run oldestMicrotask.
  • Set the event loop's currently running task back to null.

In light of this, you should also review your previous articles in series because the call stack is mentioned all over there.

Thread Thread
kabir4691 profile image
Kabir Nazir Author

but this phrasing suggest that resolve() must happen after .then(...) is attached

That wasn't how the article was phrased. I did attach code examples below it to demonstrate it better. However, I have still edited the post to make it more clearer.

I would rewrite the random example

I agree. I shall edit accordingly.

call stack is used like in many other languages meaning it contains call frames (created by calling a function and removed by returning from a function)

I'm aware of the concept of call frames. But if I had to mention that in my previous articles, I would have to go even much deeper and that could make the post very long. My aim of the articles was to give a basic but sound explanation of concepts without diving too much into advanced concepts or specifics.

articles here are presented as information (I guess assumed by beginners to be correct), not as discussion.

I think it's safe to say that it should be common knowledge for readers that articles on Dev.to are written by a myriad of people (ranging from beginner to experienced) and not by the people who actually developed the technologies. Hence, while the articles can be used as a source of information, they shouldn't be necessarily taken as a gospel of truth. The official documentation is always where any developer should consult first for precise and deep knowledge.

The same goes for other corrections you have mentioned in my post. Getting into all the details for a specific topic isn't what Dev or Medium is about. This is a blogging website, not an official documentation source. But I do understand your concern regarding the correctness of the information. What I can do is add a link at the bottom of the post redirecting the user to the official documentation (like MDN), where they can explore more about the concepts in detail.

Some comments have been hidden by the post's author - find out more