Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Another way to convert a nodelist to an array #34521

Closed
ArchivingToolsForWBM opened this issue Jul 1, 2024 · 1 comment
Closed

Another way to convert a nodelist to an array #34521

ArchivingToolsForWBM opened this issue Jul 1, 2024 · 1 comment
Labels
closed: question A user misinterpretation or support question. No action required. Content:WebAPI Web API docs

Comments

@ArchivingToolsForWBM
Copy link

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

@ArchivingToolsForWBM ArchivingToolsForWBM added the needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. label Jul 1, 2024
@github-actions github-actions bot added the Content:WebAPI Web API docs label Jul 1, 2024
@Josh-Cena
Copy link
Member

Hi! This is only meant as an example. There are so many ways to convert things to arrays we don't think it's necessary to teach you all of them, as this is not a central concern to how you use this API.

@Josh-Cena Josh-Cena closed this as not planned Won't fix, can't repro, duplicate, stale Jul 1, 2024
@Josh-Cena Josh-Cena added closed: question A user misinterpretation or support question. No action required. and removed needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. labels Jul 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed: question A user misinterpretation or support question. No action required. Content:WebAPI Web API docs
2 participants