Skip to content

Commit

Permalink
generator
Browse files Browse the repository at this point in the history
  • Loading branch information
N0FreeLunch committed Mar 28, 2021
1 parent 9746834 commit da72144
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
9 changes: 9 additions & 0 deletions generator/01-generatorFunction.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
function* declareGenerator(one, two) {
console.log("함수 블록");
yield one + two;
};

console.log("generator type : ", typeof declareGenerator);

let genObj = declareGenerator(1, 2);
console.log("generator return type : ",typeof genObj);
7 changes: 7 additions & 0 deletions generator/02-generatorFunctionVarible.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
let generator = function* (one, two) {
console.log("함수 블록");
yield one + two;
};

let genObj = generator(10, 20);
console.log(genObj.next());

0 comments on commit da72144

Please sign in to comment.