O'Reilly logo

Get Programming with JavaScript Next: New features of ECMAScript 2015, 2016, and beyond by JD Isaacks

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Lesson 23. Iterables

After reading lesson 23, you will

  • Know what an iterable is and how to use it
  • Know how to use the spread operator on iterables to ungroup an object’s items
  • Know how to use iterables in a for..in statement to loop over an object’s values
  • Know how to create your own iterables
  • Know how to customize the behavior of built-in iterables

JavaScript in ES2015 has introduced a couple of new protocols: the iterable protocol and the iterator protocol. Together these protocols describe the behavior and mechanics of objects that can be iterated—that is to say, objects that produce a series of values and can have their values looped over. When you think of objects that can be iterated, Array probably springs to mind, but you can also ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required