HTML DOM NodeList values()
❮ The NodeList ObjectExamples
List the document's child nodes:
const list = document.body.childNodes;
for (let x of list.values()) {
text += x;
}
Try it Yourself »
List the names of the document's child nodes:
const list = document.body.childNodes;
for (let x of list.values()) {
text += x.nodeName;
}
Try it Yourself »
List the types of the document's child nodes:
const list = document.body.childNodes;
for (let x of list.values()) {
text += x.nodeType;
}
Try it Yourself »
Definition and Usage
The values()
method returns an Iterator with the values from a
NodeList.
See Also:
Syntax
nodelist.values()
Parameters
NONE |
Return Value
Type | Description |
Object | An Iterator object with the values from the list. |
Browser Support
nodelist.values()
is a DOM Level 4 (2015) feature.
It is supported in all modern browsers:
Chrome | Edge | Firefox | Safari | Opera |
Yes | Yes | Yes | Yes | Yes |
nodelist.values()
is not supported in Internet Explorer 11 (or earlier).
❮ The NodeList Object