Categories
JavaScript Answers

How to convert JavaScript NodeList to an array?

Spread the love

To convert JavaScript NodeList to an array, we use the Array.from method.

For instance, we write

const myArray = Array.from(nl);

to call Array.from with nl to convery the nl node list into 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.