How do Generators work in JavaScript?

Опубликовано: 21 Октябрь 2024
на канале: GeekLaunch
548
16

Generators are a special type of function: like a hybrid between lists and functions or loops. They're useful for generating an unknown number of values, or for generating values on-demand.

Further reading:
https://developer.mozilla.org/en-US/d...
https://developer.mozilla.org/en-US/d...

Careful! NOT available in IE: https://caniuse.com/#feat=es6-generators

Music credit:
"Beam" by Gabe Miller
   / gabemillermusic  

http://geeklaunch.net/

Support GeekLaunch on Patreon:   / geeklaunch  

Follow GeekLaunch on Twitter:   / geek_launch  

GeekLaunch produces educational videos covering such topics as Linux, web development (including HTML5, CSS 3, JavaScript, and PHP), tips for power users, among many others. Subscribe: New video every Wednesday!

Not a geek? Start today!