Advertisement
Guest User

Untitled

a guest
Jun 20th, 2019
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. for (var i = 0; i < 4; i++) {
  2.   document.write('<div onClick="console.log(i)">i</div>');
  3. }
  4.  
  5.  
  6. --------------------------------------------------------------------------------
  7.  
  8.  
  9. var start = new Date();
  10.  
  11. function a1000() {
  12.     console.log('a', (new Date()) - start);
  13.     // 1000ms sync process
  14.     console.log('a', (new Date()) - start);
  15. }
  16.  
  17. function b2000() {
  18.     console.log('b', (new Date()) - start);
  19.     // 2000ms sync process
  20.     console.log('b', (new Date()) - start);
  21. }
  22.  
  23. function c3000() {
  24.     console.log('c', (new Date()) - start);
  25.     // 3000ms sync process
  26.     console.log('c', (new Date()) - start);
  27. }
  28.  
  29. function d4000() {
  30.     console.log('d', (new Date()) - start);
  31.     // 4000ms sync process
  32.     console.log('d', (new Date()) - start);
  33. }
  34.  
  35. setTimeout(a1000, 6500);
  36. setTimeout(b2000, 1000);
  37. setTimeout(c3000, 6500);
  38. setTimeout(d4000, 0);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement