Skip to content

Commit d2c97b2

Browse files
committed
Merge pull request #123 from nonsensery/con-splat-enate-arrays
Con-splat-enate Arrays
2 parents b128dcc + cf6af72 commit d2c97b2

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

Diff for: authors.md

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ The following people are totally rad and awesome because they have contributed r
2323
* [Anton Rissanen](http://github.com/antris) *[email protected]*
2424
* Calum Robertson *http://github.com/randusr836*
2525
* Jake Burkhead *https://github.com/jlburkhead*
26+
* [Alex Johnson](https://github.com/nonsensery)
2627
* ...You! What are you waiting for? Check out the [contributing](/contributing) section and get cracking!
2728

2829
# Developers

Diff for: chapters/arrays/concatenating-arrays.md

+10
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,16 @@ array1
5656
# => [1, 2, 3, 4, 5, 6]
5757
{% endhighlight %}
5858

59+
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.
60+
61+
{% highlight coffeescript %}
62+
array1 = [1, 2, 3]
63+
array2 = [4, 5, 6]
64+
array3 = [array1..., array2...]
65+
array3
66+
# => [1, 2, 3, 4, 5, 6]
67+
{% endhighlight %}
68+
5969
## Discussion
6070

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

0 commit comments

Comments
 (0)