Convert Array Like Object to an Array

/ Published in: JavaScript
Save to your folder(s)

Some HTMLCollection objects such as returned from document.getElementsByTagName() look like arrays but are not. You will need to run the object through to convert to an actual array.

This function will convert array like objects into a real array. IE does not support The try-catch will genereate an exception and convert object to an array with a loop for IE.

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.