Comprehensions, is the way CoffeeScript makes for loops very expressive. For example, the following piece of code takes a
persons array, filters it and maps it to its
womens = (person.name for person in persons when person.gender is 'F')
With Splats I can pass an array as argument to a function that normally takes multiple arguments. For examle
Math.max(). Here’s a code sample:
max = Math.max [1,2,3,4,5,6]...
Combine both features
Got an array of persons? Need to compute the max age? Write this:
maxAge = Math.max (person.age for person in persons)...