SOURCE

// 将对象转换为可迭代对象
Object.prototype[Symbol.iterator] = function*(){
    for(const k of Object.keys(this)){
         yield k;
    }
}
const a = {a: 1, b: 2}


console.log([...a])
console 命令行工具 X clear

                    
>
console