September 2024
Beginner to intermediate
985 pages
35h 37m
English
In this book, you’ve already learned about different ways to iterate over data structures such as arrays, maps, or sets. You’ve also already seen that the Map and Set data types (and Array, for that matter) return iterators via the keys(), values(), and entries() methods, which can then be used directly as input in for-of loops.
In general terms, iterators abstract iteration over data structures. In simple terms, these are objects that contain a kind of pointer to an underlying data structure that can be moved on the iterator via calls of the next() method. The respective element to which the pointer then points is returned by next() (see Figure 16.3). ...
Read now
Unlock full access