回调函数

        function a(x,callback) {
            setTimeout(() => {
                typeof(callback)==='function'&&callback(x);
            }, 2000);
        }

        a(789,function (num) {
            console.log(num)
        })

 

posted @ 2021-08-26 09:54  iHadThreeDreams  阅读(15)  评论(0)    收藏  举报