20200420
Plan
- 你不知道的 js - 第三章 代码组织
Notes
生成器
复习
语法
function* foo() {}
a = {
*foo() {},
};
运行:
var it = foo(); // 返回一个迭代器, 并不实际运行foo中的代码
yield:
function* foo() {
console.log("123");
yield;
console.log("456");
}
var it = foo(); // 不会执行console
it.next(); // 123;
it.next(); // 456;