Design Patterns · Junior · Question 13 of 75
Which pattern do for...of and Symbol.iterator implement?
- ✓Correct answer: Iterator
- 2Observer
- 3Builder
Explanation
An iterator gives a uniform way to traverse a collection sequentially without exposing its internals. Arrays, Map, Set, strings and generators implement the iteration protocol, so they work the same in for...of and spread.