IT-Academy

Cakanie

Nov 6th, 2018
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function wait(ms){
  2.    var start = new Date().getTime();
  3.    var end = start;
  4.    while(end < start + ms) {
  5.      end = new Date().getTime();
  6.   }
  7. }
  8.  
  9. console.log('before');
  10. wait(7000);  //7 seconds in milliseconds
  11. console.log('after');
Add Comment
Please, Sign In to add comment