扫码关注官方订阅号
这代码看得我很感动,所以我打出了GG,你直接在控制台输入下面代码就可以看到结果了。。。
function async(arr){ if( Object.prototype.toString.call(arr) != "[object Array]" ){ return false; } var target = arr.shift(); if(typeof target != "function"){ return false; } target(function(){ async(arr); }); } var one = function(callback){ setTimeout(function(){ console.log("first"); callback(); },200); }; var two = function(callback){ setTimeout(function(){ console.log("second"); callback(); },100); }; async([one,two]); async([one,two,two,one,two]);
我很想问,,异步总得有个url吧,你让url写成函数。。。
微信扫码关注PHP中文网服务号
QQ扫码加入技术交流群
扫描下载App
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
PHP学习
技术支持
返回顶部
这代码看得我很感动,所以我打出了GG,你直接在控制台输入下面代码就可以看到结果了。。。
我很想问,,异步总得有个url吧,你让url写成函数。。。