|Tip 41||Create Iterable Properties with Generators|
In this tip, you’ll learn how to convert complex data structures to iterables with generators.
In Tip 14, Iterate Over Key-Value Data with Map and the Spread Operator , you learned how simple it is to loop over maps thanks to iterables. And once you can iterate over a collection, you have access to the spread operator, array methods, and many other tools to transform your data. Iterables give your data more flexibility by allowing you to access each piece of data individually.
You also know that objects don’t have a built-in iterator. You can’t loop over an object directly—you need to convert part of it to an array first. That can be a major problem when you want the structure of an object ...