Skip to Content
Get Programming with JavaScript Next
book

Get Programming with JavaScript Next

by JD Isaacks
May 2018
Intermediate to advanced content levelIntermediate to advanced
376 pages
9h 22m
English
Manning Publications
Content preview from Get Programming with JavaScript Next

Unit 5. Iterables

In JavaScript, Strings and Arrays have always had a couple of things in common. They both contain an indefinite amount of stuff—characters in the case of strings and any datatype in the case of arrays. They both also have a length property indicating how many items they have. But there was never a common protocol that described how these things worked. Starting in ES2015, there are two new protocols that describe these JavaScript behaviors, known as the iterable and iterator protocols.

Strings and Arrays are now known as iterables. This means they adhere to the new iterable protocol and can be predictably interacted with in common ways, including being used with the new for..of statement and the new spread operator. There ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Get Programming with JavaScript

Get Programming with JavaScript

John Larsen
Rediscovering JavaScript

Rediscovering JavaScript

Venkat Subramaniam

Publisher Resources

ISBN: 9781617294204Supplemental ContentPublisher SupportOtherPublisher WebsiteSupplemental ContentPurchase Link