|  | @@ -0,0 +1,44 @@
 | 
											
												
													
														|  | 
 |  | +<!DOCTYPE html>
 | 
											
												
													
														|  | 
 |  | +<html lang="en">
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +<head>
 | 
											
												
													
														|  | 
 |  | +  <meta charset="UTF-8">
 | 
											
												
													
														|  | 
 |  | +  <meta http-equiv="X-UA-Compatible" content="IE=edge">
 | 
											
												
													
														|  | 
 |  | +  <meta name="viewport" content="width=device-width, initial-scale=1.0">
 | 
											
												
													
														|  | 
 |  | +  <title>Document</title>
 | 
											
												
													
														|  | 
 |  | +</head>
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +<body>
 | 
											
												
													
														|  | 
 |  | +  <script>
 | 
											
												
													
														|  | 
 |  | +    // 说出下面代码的输出
 | 
											
												
													
														|  | 
 |  | +    async function async1() {
 | 
											
												
													
														|  | 
 |  | +      console.log('async1 start');
 | 
											
												
													
														|  | 
 |  | +      await async2();
 | 
											
												
													
														|  | 
 |  | +      console.log('async1 end');
 | 
											
												
													
														|  | 
 |  | +    }
 | 
											
												
													
														|  | 
 |  | +    async function async2() {
 | 
											
												
													
														|  | 
 |  | +      console.log('async2');
 | 
											
												
													
														|  | 
 |  | +      /* return new Promise((resolve, reiejct) => {
 | 
											
												
													
														|  | 
 |  | +        resolve()
 | 
											
												
													
														|  | 
 |  | +      }) */
 | 
											
												
													
														|  | 
 |  | +      /* Promise1.then((Promise2)=>{
 | 
											
												
													
														|  | 
 |  | +        Promise2.then(()=>{
 | 
											
												
													
														|  | 
 |  | +          console.log()
 | 
											
												
													
														|  | 
 |  | +        })
 | 
											
												
													
														|  | 
 |  | +      }) */
 | 
											
												
													
														|  | 
 |  | +    }
 | 
											
												
													
														|  | 
 |  | +    console.log('script start')
 | 
											
												
													
														|  | 
 |  | +    async1();
 | 
											
												
													
														|  | 
 |  | +    new Promise(function (resolve) {
 | 
											
												
													
														|  | 
 |  | +      console.log('promise1');
 | 
											
												
													
														|  | 
 |  | +      resolve();
 | 
											
												
													
														|  | 
 |  | +    }).then(function () {
 | 
											
												
													
														|  | 
 |  | +      console.log('promise2');
 | 
											
												
													
														|  | 
 |  | +    });
 | 
											
												
													
														|  | 
 |  | +    console.log('script end')
 | 
											
												
													
														|  | 
 |  | +     //sc start => asy1 start => asy2 => p1 => sc end =>  p2 => asy1 end 
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +  </script>
 | 
											
												
													
														|  | 
 |  | +</body>
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +</html>
 |