3 ms·
I should have explained the use case better: I need to store an indexed array of elements for cache/querying later on; so forEach() isn't a good fit here. Othe
by Carpetsmoker 8y ago
I should have explained the use case better: I need to store an indexed array of elements for cache/querying later on; so forEach() isn't a good fit here.
Other people suggested Array.from(), but that won't work in IE, and the polyfill for it is a lot longer/more complex than the for loop I wrote.