SOURCE

const forOf = (arr, cb) => {
    let iterable, result;
    iterable = arr[Symbol.iterator]();
    result = iterable.next();
    while (!result.done) {
        cb(result.value)
        result = iterable.next();
    }
}

let arr =  [{
    name: 'a'
}, {
    name: 'b'
}]

forOf(arr, (v) => { console.log(v) })
console 命令行工具 X clear

                    
>
console