JS Built-ins
Symboliteratorbeginner

Symbol.iterator β€” strings are iterable

πŸ“– Usage Example
typeof ''[Symbol.iterator]   // β†’ 'function'
[...'abc']                   // β†’ ['a', 'b', 'c']

Strings implement Symbol.iterator, allowing them to be spread into individual characters.

String Symbol.iterator

Strings also have a Symbol.iterator method.

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

πŸ’‘ Hints (1)
  • β€’ Strings implement the iterable protocol, yielding individual characters.