#JavaScript #JS
In this episode, we'll discuss how to make a custom object iterable with for...of. Iterators, or iterable objects, are objects that can be iterated over in a loop. Sometimes it's useful to create a custom iterator for your own objects that aren't iterable by default. This is helpful because it makes working with such objects easier. You simply need to write your own iteration algorithm and return a specific result. To make an object iterable, the object must have a Symbol.iterator field. This field must be a function. The function must return an object with a next field. next is a function that in turn must return an object with value and done fields.
Find us on social media:
💻 Website: https://it-dev-journal.ru
💻 Telegram: https://t.me/devmagazinechannel
💻 Twitter: / _devmagazine
💻 GitHub: https://github.com/vadimkorr
☕️ 🍫 🍩 Support the channel: https://www.donationalerts.com/r/devm...
📃 Source code: https://t.me/devmagazinechannel/81
#devmagazine #devmagazinechannel
On this page of the site you can watch the video online Are iterators useful in JavaScript? with a duration of hours minute second in good quality, which was uploaded by the user Веб-разработка - DevMagazine 25 May 2021, share the link with friends and acquaintances, this video has already been watched 3,703 times on youtube and it was liked by 114 viewers. Enjoy your viewing!