Built-in Iterables

built-in iterables explained using examples

You have seen four examples for built-in iterables among the previous lessons:

  • Arrays are iterables, and work well with the for-of loop.
  • Strings are iterables as arrays of 2 to 4-byte characters.
  • DOM data structures are also iterables. If you want proof, just open a random website, and execute [...document.querySelectorAll('p')] in the console
  • Maps and Sets are iterables.

Let’s experiment with built-in iterables a bit:

Level up your interview prep. Join Educative to access 70+ hands-on prep courses.