We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b128dcc commit 77905d7Copy full SHA for 77905d7
chapters/arrays/concatenating-arrays.md
@@ -56,6 +56,16 @@ array1
56
# => [1, 2, 3, 4, 5, 6]
57
{% endhighlight %}
58
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
69
## Discussion
70
71
CoffeeScript lacks a special syntax for joining arrays, but `concat()` and `push()` are standard JavaScript methods.
0 commit comments