❝说起ES6的解构赋值,也许大家觉得非常简单,但如果是下面这个题,大家觉得sixth输出的值应该是多少呢?
❞
试试看吧:
function* fibs() {
let a = 0;
let b = 1;
while (true) {
yield a;
[a, b] = [b, a + b];
}
}
let [first, second, third, fourth, fifth, sixth] = fibs();
console.log(sixth)
关于作者:JeremyCC
一个爱唱歌的前端工程狮,喜欢我可以点关注噢!(头像仅供参考,哈哈)