Skip to content

Commit

Permalink
Add square array brackets
Browse files Browse the repository at this point in the history
  • Loading branch information
cpursley committed Apr 20, 2015
1 parent abea624 commit 349ba7b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion chapters/arrays/reducing-arrays.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,11 @@ You can simply use Array's `reduce()` and `reduceRight()` methods along with an
Or it may be something more complex such as aggregating elements from a list into a combined object.

{% highlight coffeescript %}
people =
people = [
{ name: 'alec', age: 10 }
{ name: 'bert', age: 16 }
{ name: 'chad', age: 17 }
]

people.reduce (x, y) ->
x[y.name]= y.age
Expand Down

0 comments on commit 349ba7b

Please sign in to comment.