Join Alexander Zanfir for an in-depth discussion in this video What are generators?, part of Learning Node.js.
- ES6 approved features under Harmony have been slowly…getting added to the V8 engine, and thus, Node.…Now with COA becoming more popular, ES6 features…like generator functions are becoming more in demand.…In this chapter, we will take a look at some…of the more advanced but very useful features from ES6.…Let's start by going over a generator example.…You can open up the generator-functions-demo.js…from your examples.…And on line 6, you can see that we save reference…into the object that generates for us into iter.…
We are using the yield keyword.…This is, in a way, similar to how…our return controls execution flow.…Let's run the script to see what happens…and what is displayed.…And to do that, we'll need to use our console…or terminal, since we need to use the harmony flag.…And we'll supply the harmony flag,…and we'll execute generator-functions-demo.js.…So if we move that over and compare the values…to the code, we can try to make sense of what's happening.…
The first line is hello, therefore we are getting the value…
- Installing Node.js
- Writing modules and packages
- Reading and writing files
- Working with frameworks: Express, Sails, and Koa
- Generating promises
- Working with generator functions
Skill Level Beginner
Q: When I try to install Bluebird/Express/Gulp/Sails/KOA using the Node Package Manager, it seems to install correctly in the terminal. But why doesn't my project folder change?
A: You need to make sure that you've navigated to your project folder in the terminal. For example, in this course Alexander is working from the C:\Dev\ folder both in Brackets and in the terminal.