Our applications will almost always make use of data and in some cases a lot of data. In this section, we will investigate some useful ways to work with collections of data using CoffeeScript and its list comprehension feature and various JavaScript methods made available on the array
object.
CoffeeScript provides convenient operators to iterate through collections of data by using loops and comprehensions.
For our example, we will be working with the following array of employee objects:
employees = [ { id: 10, firstName: 'Tracy', lastName: 'Ouellette', salesYtd: 22246 } { id: 2, firstName: 'Chris', lastName: 'Daniel', salesYtd: 3876 } { id: 3, firstName: 'Jason', lastName: 'Alexander', salesYtd: 4095 } { id: 4, firstName: 'Jennifer', lastName: 'Hannah', salesYtd: 8070 } { id: 5, firstName: 'Maxx', lastName: 'Slayde', salesYtd: 2032 } ]