3.html 855 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  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. setTimeout(function () {
  15. console.log('setTimeout1')
  16. }, 0)
  17. }
  18. async function async2() {
  19. setTimeout(function () {
  20. console.log('setTimeout2')
  21. }, 0)
  22. }
  23. console.log('script start')
  24. setTimeout(function () {
  25. console.log('setTimeout3')
  26. }, 0)
  27. async1()
  28. new Promise(function (r, j) {
  29. console.log('Promise1')
  30. r()
  31. }).then(function () {
  32. console.log('Promise2')
  33. })
  34. console.log('script end')
  35. </script>
  36. </body>
  37. </html>