手写个简单的Array.prototype.values()遍历器
Array.prototype.values = function(){ let i = 0; let self = this return { next(){ const done = i>= self.length const value = done? undefined : self[i++] return { value, done } } } } const color = ['red','green','white']; //控制台 color.values() color.next() 输出……xxx 自己尝试一下把
……