Hacker News new | ask | show | jobs
by bsimpson 2858 days ago
This feels intellectually dishonest.

The next line in JS is guaranteed to execute immediately after the preceding one; except in the case of callbacks (including sugar, like promises), which are also executed sequentially, but deferred until they are explicitly called by whatever they're passed to. In fact, one of the biggest complaints about JavaScript (that it can block the main thread if it tries to do too much in one frame) is a consequence of this guarantee.

Granted, I've written primarily JavaScript for the last five years, but it's pretty straightforward to reason about. Any language that lets you respond to events, I/O, etc. is going to require that you reason about things over time - JavaScript is no outlier here.

The way you've written your remark, it sounds as if JavaScript executes lines out of order, or will wait an arbitrary amount of time to move from one line to the next. Obviously, neither of those is true.