by sandrot · 5y ago · 0 comments
Spread syntax is my goto for that:
[...arrayish].forEach(...)
But, it being JavaScript, there’s probably a subtle distinction in where Array.from(arrayish) works and where [...arrayish] works.`...foo` requires `foo` to be an iterable (implements the iterator known symbol).
`Array.From()` only requires it to be array-like and not necessarily iterable.