JS: Iterable Interface
Object having Iterable Interface is called Iterable Object.
It must have the property Symbol.iterator, owned or inherited.
Iterable Interface Properties
Symbol.iterator-
Symbol.iteratoris a Symbol.- Value must be a function.
- This function's return value must be an object that conforms to the Iterator Interface.
Example
array is iterable object.
Because it has inherited property key Symbol.iterator.
// array has an inherited property key Symbol.iterator console.log(Reflect.has([3, 4], Symbol.iterator)); // not its own property console.log(Object.hasOwn([3, 4], Symbol.iterator) === false); // the property Symbol.iterator of array is inherited from Array.prototype console.log(Object.hasOwn(Array.prototype, Symbol.iterator)); // true