The real lesson is to avoid iterating over large result sets in JS by filtering them in your DB.
There are cases where large data sets are generated in the browser, but that is not even close to often.
Even in the world of game dev, JavaScript is not common at all.