数组的values()方法, 在浏览器里调试正常, 在node环境中报错
const a = ["a", "b", "c"];
for(let key of a.keys()) {
console.log(key); // 0 1 2 正常
}
for(let value of a.values()) {
console.log(value);
}
报错信息如下
a.values(...) is not a function or its return value is not iterable
a.values不是一个函数
你使用的node版本应该不支持
Array.prototype.values
你可以在node中打印下
Array.prototype.values
,应该是undefined