SOURCE

function test() {
    let arr = []
    for(let i = 0 ; i < 10 ; i++) {
        arr[i] = function(){
            document.write(' '+ i);
        }
    }
    return arr
}
const funarr = test()
funarr.forEach((item,index)=>{
    item()
})
console 命令行工具 X clear

                    
>
console