Another way to convert a nodelist to an array #34521
Labels
closed: question
A user misinterpretation or support question. No action required.
Content:WebAPI
Web API docs
MDN URL
https://developer.mozilla.org/en-US/docs/Web/API/NodeList
What specific section or headline is this issue about?
Although NodeList is not an Array, it is possible to iterate over it with forEach(). It can also be converted to a real Array using Array.from().
What information was incorrect, unhelpful, or incomplete?
What's incomplete is that you can also use a spread syntax on the nodelist inside an array like so:
[...NodeList]
due to the fact that NodeList are iterable.What did you expect to see?
Mentioning of another way to convert iterable array-like objects such as a nodelist.
Do you have any supporting links, references, or citations?
https://stackoverflow.com/questions/40548213/array-from-vs-spread-syntax
Do you have anything more you want to share?
No response
MDN metadata
No response
The text was updated successfully, but these errors were encountered: