Using Custom Iterators
Learn which data types can be iterated with for loop and which needs symbols to iterate over them.
We'll cover the following...
The built-in collections in JavaScript, like Array
, Set
, and Map
, are all iterable. Using the for
loop, we can iterate over them to process the elements. But, what about user-defined classes?
Iterators for user-defined classes
For example, you might create a Car
class, and you want the user ...