I was very touched by this code, so I typed GG. You can directly enter the following code in the console to see the result. . .
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]);
I really want to ask, there must be a url for asynchronous use. You can write the url as a function. . .
I was very touched by this code, so I typed GG. You can directly enter the following code in the console to see the result. . .
I really want to ask, there must be a url for asynchronous use. You can write the url as a function. . .