首先看一段代码 function* fib (max) { let a = 0 let b = 1 let n = 1 while (n < max) { yield a; [a, b] = [b, a + b] } } let [first, second, third, fourth, fifth] = fib(5) 实现裴波那切数列,输出结果,正常 [first, second, third, fourth, fifth] // 0, 1, 1, 2, 3 注意看第6行,加入将第6行后的分…