Join Eve Porcello for an in-depth discussion in this video Generators, part of Learning ECMAScript 6.
- Generators are a new type of function…that allow us to pause functions in the middle…of execution, to be resumed later.…You know you're looking at a generator…when you see an asterisk…immediately following the function keyword.…Sometimes you'll see people use the asterisk…right before the function name.…We hit pause within our function…by using the new yield keyword.…And this can be used multiple times…within the same function.…Now to use a generator in our code in the browser,…we need to grab one more link…from the cdnjs site.…
We're going to use the browser-polyfill.js link,…and we're just going to paste this into our HTML document.…So here we'll create another script tag,…and then we'll give it a source.…And we'll just paste that browser-polyfill link…right here in our head tag.…Now that that's set up,…we're going to create a generator.…So on line seven, I'm going to use…the function keyword with our asterisk.…And we're going to create a director generator.…
So the director generator is going…to have several yield statements…
- What is ECMAScript?
- Transpiling ECMAScript with Babel and Babel-node
- Using the let and const keywords
- Creating strings with template strings
- Enhancing object literals
- Working with ES6 classes and class inheritance
Skill Level Beginner
Q: The Babel API is out of date. How do I proceed with the course?
A: We are updating the course. In the meantime, you can install the babel-cli package and then install the presets that you need to follow along with the tutorials.
1. What Is ECMAScript 6 (ES6)?
2. Transpiling ES6
3. ES6 Syntax
4. ES6 Functions & Objects
5. Asynchronous Features
6. ES6 Classes
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.