下面是一个js自定义的wait函数,可以暂停程序的执行
function sleep(delay) { var start = new Date().getTime(); while (new Date().getTime() < start + delay); } //usage //wait for 3 seconds sleep(3000);
下面是一个js自定义的wait函数,可以暂停程序的执行
function sleep(delay) { var start = new Date().getTime(); while (new Date().getTime() < start + delay); } //usage //wait for 3 seconds sleep(3000);