DEV Community

Discussion on: ūüöÄ 5 Reasons Why You Should Bet on JavaScript in 2020

lukaszahradnik profile image
Luk√°Ň° Zahradn√≠k

How is that a problem?

Thread Thread
jorgecc profile image
Jorge Castro

Because it's messy, it's prone to mistakes and some code simply ends blowing with random errors that sometimes happens while other time it works.

It is conventional programming:

  • Task #1
  • Task #2
  • Task #3
  • Return the result

And it is what JS does.

  • Call to task #1 call back and wait
  • Call to task #2 call back and wait
  • Call to task #3 call back and wait
  • Return the result.
  • callback of task #1
  • callback of task #2
  • callback of task #3

If task #1 is not called with await, then it could be executed after or before task #2.

Thread Thread
lukaszahradnik profile image
Luk√°Ň° Zahradn√≠k • Edited on

Your arguments are misleading.

It's quite common for programming languages to support asynchronous/parallel evaluation.

Also you don't have to use asynchronous tasks, if you dislike them so much, and declare functions as synchronous.

If task #1 is not awaited, then probably we don't care about it's return value/side effects so there is no problem with order of execution.