What does the “…” (triple dot) notation in arrays mean? [duplicate]

The ...(spread operator) works by returning each value from index 0 to index length-1:

As example:

[...'18'] // returns ['1', '8']

which would be the same as:

['18'[0], '18'[1]]

Now, to get an array from 1 to 18, you can do this:


Or this with map:


Hope it helps.

Leave a Comment