The built-in iterable objects in JavaScript include "Array", "Map", "Set", "String", "TypedArray", "NodeList" and "Arguments": 1. Array, array object; 2 , Map, is a collection of key-value pairs; 3. Set, is a collection; 4. String, a string object; 5. TypedArray, an array-like object; 6. NodeList, a node list object, etc.
# Operating system for this tutorial: Windows 10 system, Dell G3 computer.
In JavaScript, some built-in objects are iterable, which means they support traversal using for...of loops. Here are some of the built-in iterable objects in JavaScript:
Array: Array objects are one of the most commonly used iterable objects and can be used to iterate over the elements in the array using a for…of loop.
Map: Map object is a collection of key-value pairs, and you can use the for...of loop to traverse the key-value pairs.
Set: A Set object is a collection whose elements can be traversed using a for…of loop.
String: The string object is also an iterable object, and you can use the for...of loop to traverse the characters in it.
TypedArray: A TypedArray object is an array-like object whose elements can be iterated over using a for…of loop.
NodeList: The NodeList object is a node list object, and you can use the for...of loop to traverse the nodes in it.
Arguments object: The Arguments object is an array-like object of function parameters, and you can use the for...of loop to traverse the parameters in it.
In addition to these built-in iterable objects, developers can also customize iterable objects. They only need to implement the Symbol.iterator method on the object to make the object an iterable object. .
The above is the detailed content of What are the built-in iterable objects in js?. For more information, please follow other related articles on the PHP Chinese website!