1.这种不是匀速, 写到for循环中出现1,2,3.......456....的情况
function sleep(milliseconds) { var start = new Date().getTime(); for (var i = 0; i < 1e7; i++) { if ((new Date().getTime() - start) > milliseconds){ break; } } }
1.这种不是匀速, 写到for循环中出现1,2,3.......456....的情况
function sleep(milliseconds) { var start = new Date().getTime(); for (var i = 0; i < 1e7; i++) { if ((new Date().getTime() - start) > milliseconds){ break; } } }
转载于:https://www.cnblogs.com/yadongliang/p/10780771.html