SOURCE

let newSetTimeout = function(fn,delay){
    let timer = null;
    function interval(){
        fn();
        setTimeout(interval,delay);
    }
    interval();
    return{
        cancel(){
            clearTimeout(timer);
        }
    } 
}

let newSetInterval = function(fn,delay){
    let timer = null;
     timer = setInterval(()=>{
            fn();
            clearInterval(timer);
        },delay);
}
console 命令行工具 X clear

                    
>
console