Skip to content

Commit

Permalink
update generators lecture
Browse files Browse the repository at this point in the history
  • Loading branch information
15Dkatz committed Feb 12, 2017
1 parent 3f22cf9 commit b45b7be
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions course_material/lectures/generators/definining_generators/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// // parts 1-2:
// function* letterMaker() {
// yield 'a';
// yield 'b';
// yield 'c';
// }
//
// let letterGen = letterMaker();
//
// // part 1:
// console.log(letterGen.next().value);
//
// // part 2:
// console.log(letterGen.next().value);
// console.log(letterGen.next().value);

// // part 3:
// function* countMaker() {
// let count = 0;
// while (count < 3) {
// yield count += 1;
// }
// }
//
// let countGen = countMaker();
// console.log(countGen.next().value);
// console.log(countGen.next().value);
// console.log(countGen.next().value);
// console.log(countGen.next().value); // undefined
//

0 comments on commit b45b7be

Please sign in to comment.