Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions authors.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ The following people are totally rad and awesome because they have contributed r
* [Anton Rissanen](http://github.com/antris) *[email protected]*
* Calum Robertson *http://github.com/randusr836*
* Jake Burkhead *https://github.com/jlburkhead*
* [Alex Johnson](https://github.com/nonsensery)
* ...You! What are you waiting for? Check out the [contributing](/contributing) section and get cracking!

# Developers
Expand Down
10 changes: 10 additions & 0 deletions chapters/arrays/concatenating-arrays.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,16 @@ array1
# => [1, 2, 3, 4, 5, 6]
{% endhighlight %}

A more idiomatic approach is to use the splat operator (`...`) directly in an array literal. This can be used to concatenate any number of arrays.

{% highlight coffeescript %}
array1 = [1, 2, 3]
array2 = [4, 5, 6]
array3 = [array1..., array2...]
array3
# => [1, 2, 3, 4, 5, 6]
{% endhighlight %}

## Discussion

CoffeeScript lacks a special syntax for joining arrays, but `concat()` and `push()` are standard JavaScript methods.