Categories
JavaScript Answers

How to convert an HTMLCollection to an array with JavaScript?

Spread the love

To convert an HTMLCollection to an array with JavaScript, we use the spread operator.

For instance, we write

const array = [...htmlCollection];

to use the spread operator to spread the items in htmlCollection to an array.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published.