3 ms·
... 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
by tuukkah 4y ago
... 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/Reference/Operators/Spread_syntax 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/Guide/Indexed_collections#sparse_arrays https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guid...
- prox 4y agoThat is neat! Thanks!