November 2013
Intermediate to advanced
148 pages
3h 12m
English
ECMAScript Harmony introduces a new concept called a generator. A generator is like a function except that you can suspend its execution and resume later.
This feature isn’t quite ready for prime time, and you’ll need a version of Node higher than 0.10.x to try it out (unstable 0.11, for example). However, this is the direction ECMAScript is heading, and it’ll be production-ready before you know it.
Once a regular JavaScript function starts executing, it can finish in one of two ways. Either it finishes normally by getting to the end or hitting a return statement, or it finishes abnormally, throwing an exception. In both cases, the function will run to conclusion.
Generators are different. With a generator, you ...
Read now
Unlock full access