---
title: "NodeList | JavaScript maps SDK"
description: "Documentation for MapTiler SDK"
---

# Interface NodeList

**`NodeList`** objects are collections of nodes, usually returned by properties such as Node.childNodes and methods such as document.querySelectorAll().

[MDN Reference](https://developer.mozilla.org/docs/Web/API/NodeList)

interface NodeList {  
    [length](#length): number;  
    ["\[iterator\]"](#iterator-1)(): [ArrayIterator](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.ArrayIterator/)<[Node](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.Node/)\>;  
    [entries](#entries-1)(): [ArrayIterator](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.ArrayIterator/)<\[number, [Node](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.Node/)\]\>;  
    [forEach](#foreach-1)(  
        callbackfn: (value: [Node](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.Node/), key: number, parent: NodeList) \=> void,  
        thisArg?: any,  
    ): void;  
    [item](#item-1)(index: number): [Node](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.Node/) | null;  
    [keys](#keys-1)(): [ArrayIterator](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.ArrayIterator/)<number\>;  
    [values](#values-1)(): [ArrayIterator](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.ArrayIterator/)<[Node](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.Node/)\>;  
    \[index: number\]: [Node](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.Node/);  
}

#### Hierarchy ([View Summary](https://docs.maptiler.com/sdk-js/api-reference/hierarchy/#Externals.NodeList))

-   NodeList
    -   [NodeListOf](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.NodeListOf/)

#### Indexable

-   \[index: number\]: [Node](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.Node/)
    

##### Index

### Properties[](#properties)

[length](#length)

### Methods[](#methods)

[\[iterator\]](#iterator) [entries](#entries) [forEach](#foreach) [item](#item) [keys](#keys) [values](#values)

## Properties[](#properties-1)

### `Readonly`length[](#length)

length: number

The **`NodeList.length`** property returns the number of items in a NodeList.

[MDN Reference](https://developer.mozilla.org/docs/Web/API/NodeList/length)

## Methods[](#methods-1)

### \[iterator\][](#iterator)

-   "\[iterator\]"(): [ArrayIterator](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.ArrayIterator/)<[Node](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.Node/)\>[](#iterator-1)
    
    #### Returns [ArrayIterator](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.ArrayIterator/)<[Node](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.Node/)\>
    

### entries[](#entries)

-   entries(): [ArrayIterator](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.ArrayIterator/)<\[number, [Node](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.Node/)\]\>[](#entries-1)
    
    Returns an array of key, value pairs for every entry in the list.
    
    #### Returns [ArrayIterator](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.ArrayIterator/)<\[number, [Node](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.Node/)\]\>
    

### forEach[](#foreach)

-   forEach(  
        callbackfn: (value: [Node](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.Node/), key: number, parent: NodeList) \=> void,  
        thisArg?: any,  
    ): void[](#foreach-1)
    
    #### Parameters
    
    -   callbackfn: (value: [Node](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.Node/), key: number, parent: NodeList) \=> void
    -   `Optional`thisArg: any
    
    #### Returns void
    

### item[](#item)

-   item(index: number): [Node](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.Node/) | null[](#item-1)
    
    Returns a node from a NodeList by index. This method doesn't throw exceptions as long as you provide arguments. A value of null is returned if the index is out of range, and a TypeError is thrown if no argument is provided.
    
    [MDN Reference](https://developer.mozilla.org/docs/Web/API/NodeList/item)
    
    #### Parameters
    
    -   index: number
    
    #### Returns [Node](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.Node/) | null
    

### keys[](#keys)

-   keys(): [ArrayIterator](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.ArrayIterator/)<number\>[](#keys-1)
    
    Returns an list of keys in the list.
    
    #### Returns [ArrayIterator](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.ArrayIterator/)<number\>
    

### values[](#values)

-   values(): [ArrayIterator](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.ArrayIterator/)<[Node](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.Node/)\>[](#values-1)
    
    Returns an list of values in the list.
    
    #### Returns [ArrayIterator](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.ArrayIterator/)<[Node](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.Node/)\>
