1.html 764 B

12345678910111213141516171819202122232425262728293031323334
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7. <title>Document</title>
  8. </head>
  9. <body>
  10. <script>
  11. async function async1() {
  12. console.log('async1 start');
  13. await async2();
  14. console.log('async1 end');
  15. }
  16. async function async2() {
  17. console.log('async2');
  18. }
  19. console.log('script start')
  20. async1();
  21. new Promise(function (resolve) {
  22. console.log('promise1');
  23. resolve();
  24. }).then(function () {
  25. console.log('promise2');
  26. });
  27. console.log('script end')
  28. //sc start => asy1 start => asy2 => p1 => sc end => asy1 end => p2
  29. </script>
  30. </body>
  31. </html>