How do you make an object iterable in javascript

Posted by Jennifer | Updated on

By default, plain objects are not iterable. But you can make the object iterable by defining a Symbol.iterator property on it.

Let’s demonstrate this with an example:

The above process can be simplified using a generator function,

If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@] Your question and answer will appear on and help other developers.

Related Questions & Answers