Lurker News
Back to discussion

Comment by tuukkah

tuukkah1 reply#
... is the spread syntax, which is a neat way to use the entries of an existing array or object in an argument list or within an array or object literal.

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
Array(length) creates an array that has a length but no elements (or weird, "empty" elements). The square brackets create a new array [...Array(length)] which will have undefined elements instead, as trying to access an "empty" element returns undefined.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guid...

prox#
That is neat! Thanks!