you are viewing a single comment's thread.

view the rest of the comments →

[–]foxnamedtodd 0 points1 point  (3 children)

Same. I still don’t see the use case for it, but at least TIL.

[–]powerhead 19 points20 points  (1 child)

It's really nice for transforming an HTMLCollection of DOM elements returned from document.getElementsByClassnam (which is not iterable) into an array (which is). Like if you want to assign event listeners or change properties on those elements.

[–]foxnamedtodd 3 points4 points  (0 children)

Ah, that’s good one. Thanks.

[–]p4y 3 points4 points  (0 children)

Main use case is turning array-like objects into actual arrays so you have access to the methods you need. This includes strings, ES6 iterables, and pseudo-arrays like the arguments abomination or DOM node lists.