按照阮一峰的ECMA6标准入门例子写的,运行环境为vscode
"use strict"function* fibs() { let a = 0; let b = 1; while (true) { yield a;
[a, b] = [a, a+b];
}
}let [first, second, third, fourth, fifth, sixth] = fibs();console.log(sixth)运行报错,报错为
[a, b] = [a, a+b]; ^
ReferenceError: Invalid left-hand side in assignment
有知道为什么的大牛吗?
喵喵时光机
随时随地看视频慕课网APP
相关分类