Re: toArray() method for array-like DOM list objects

To add to the conversation. A recent jsperf
http://jsperf.com/toarray-vs-slice shows that toArray and slice.call have
similar levels of performance depending on array sizes.

And I believe es.next will have Array.from (
https://mail.mozilla.org/pipermail/es-discuss/2011-July/015831.html ) which
is basically an official readable method to turn an array like into an
array.

However as a web developer, I will add that the most common utility
function I use when working with the DOM is a toArray function. I use a
toArray function becuase "what does slice.call do?" is a common question.

Received on Saturday, 24 December 2011 01:10:33 UTC