You don't need each, collect or select in Coffeescript
Array class now has
We also don't write so much CoffeeScript anymore.
Array class is so poorly designed.
One way to reduce the pain is to to use Underscore.js's functions like
_.select, which unfortunately clutters your code with awkward calls to the
Fortunately when you use CoffeeScript you don't need any of that. CoffeeScript has a very versatile
for keyword that can do anything that
select can do. Enjoy!
for item in items ...
collect / map
ages = (person.age for person in people)
select / grep
adults = (person for person in people when person.age >= 18)