JS Built-ins
Symboliteratorbeginner

Symbol.iterator β€” arrays are iterable

πŸ“– Usage Example
typeof [][Symbol.iterator]   // β†’ 'function'
[...([1, 2, 3])]             // β†’ [1, 2, 3]

Arrays expose Symbol.iterator as a function that enables for...of and spread syntax.

Array Symbol.iterator

Arrays have a Symbol.iterator method that makes them iterable.

Challenge: Verify that [][Symbol.iterator] is a function.

πŸ’‘ Hints (1)
  • β€’ Arrays implement the iterable protocol via Symbol.iterator.