News for hackers. Stuff that matters.
Re:A Modern JavaScript Tutorial by jedimastert on Monday December 07, 2020 @12:14PM (#25334190)
Can you point to anything other than saying "this is obvious"?
Re:A Modern JavaScript Tutorial by nailer on Monday December 07, 2020 @12:18PM (#25334251)
No, just experience with a lot of codebases.

Here's a simple question to ask yourself: what if non-IO operations allowed you to use the .then() syntax? If you have the choice to use:

   1 + 1.then(function(result) { ... }
vs

   const result = 1 + 1
Which would you choose?
Re:A Modern JavaScript Tutorial by pavlov on Monday December 07, 2020 @12:24PM (#25334327)
Using then() doesn't pause execution of the callsite function, while await does. Surely that's a relevant difference here?

It doesn't seem unreasonable to use then() to express: "Run this anonymous function whenever the async thing completes. Meanwhile let's do this other stuff right now."

Re:A Modern JavaScript Tutorial by nailer on Monday December 07, 2020 @12:59PM (#25334842)
Both codebases can't do anything until `result` has a value.