Update (Dec 2019): Node.js now supports top-level await which would solve the pain point outlined in this article. This article was written in 2015 with Node.js v0.12 in mind.
Consider this scenario: there's a strange bug in production's data that you need to inspect. In Rails, you can tell rails console
: "show me all project IDs that are active and made by users that never logged in" like so:
This may not be the most efficient way to do it, but some situations are urgent and will call for one-offs like these.
In Node.js, you'll probably do something like this:
Ah, granted that promises and ES6 (fat arrows) would make this better, but still...