HTML DOM NodeList keys() Method

Definition and Usage

The keys() method returns an Iterator that contains the keys of the NodeList.

Example

Example 1

List the keys of the document's child nodes:

const list = document.body.childNodes;
for (let x of list.keys()) {
  text += x;
}

Try It Yourself

Example 2

List the child nodes of the document:

const list = document.body.childNodes;
for (let x of list.values()) {
  text += x;
}

Try It Yourself

Syntax

nodelist.keys()

Parameters

No parameters.

Return Value

Type Description
Object Iterator object na may mga susunod na salita ng listahan.

Browser Support

nodelist.keys() ay DOM Level 4 (2015) na katangian.

Lahat ng modernong browser ay sumusuporta sa ito:

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Supported Supported Supported Supported Supported

Internet Explorer 11 (o mas maaga na bersyon) ay hindi sumusuporta sa nodelist.keys().

Related Pages

length Attribute

entries() Method

forEach() Method

item() Method

values() Method

NodeList Object

childNodes() Method

querySelectorAll() Method

getElementsByName() Method