按照阮一峰的ECMA6標準入門例子寫的,運行環(huán)境為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有知道為什么的大牛嗎?
ES6 對象解構賦值問題
喵喵時光機
2018-10-16 21:23:53