d3.js 부분도 보고 있는데, 제대로 머리에 들어간게 없어서 TIL에는 기재 안함
내일은 Crafting Interpreters 꼭 하자.
funcion*
function*
declaration (function
keyword followed by an asterisk) defines a generator function, which returns a Generator object.next()
method is called, the generator function's body is executed until the first yield expression, which specifies the value to be returned from the iterator or, with yield*
, delegates to another generator function. The next()
method returns an object with a value
property containing the yielded value and a done
property which indicates whether the generator has yielded its last value, as a boolean. Calling the next()
method with an argument will resume the generator function execution, replacing the yield expression where an execution was paused with the argument from next()
.return
statement in a generator, when executed, will make the generator finish (i.e. the done
property of the object returned by it will be set to true
). If a value is returned, it will be set as the value property of the object returned by the generator. Much like a return statement, an error thrown inside the generator will make the generator finished — unless caught within the generator's body. When a generator is finished, subsequent next() calls will not execute any of that generator's code, they will just return an object of this form: {value: undefined, done: true}
.