#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
Sur cette page du site, vous pouvez voir la vidéo en ligne Are iterators useful in JavaScript? durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur Веб-разработка - DevMagazine 25 mai 2021, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 3,703 fois et il a aimé 114 téléspectateurs. Bon visionnage!