| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 | 
							- <!DOCTYPE html>
 
- <html lang="en">
 
- <head>
 
-     <meta charset="UTF-8">
 
-     <meta name="viewport" content="width=device-width, initial-scale=1.0">
 
-     <title>Document</title>
 
- </head>
 
- <body>
 
-     <!-- 
 
-         Promise:构造函数
 
-         执行方向:自上到下
 
-         同步执行
 
-         异步执行
 
-         状态:三种状态
 
-             成功 resolve/fulfilled
 
-             失败 reject
 
-             等待 pending
 
-         js执行顺序:
 
-             先同步 后异步(先微后宏)
 
-     -->
 
-     <script>
 
-         // var a = 1;
 
-         // console.log(a);
 
-         // new Promise((resolve,reject)=>{
 
-         //     // 执行的代码块
 
-         //     reject();
 
-         //     console.log(12)
 
-         // }).then(()=>{
 
-         //     // 执行成功的代码块
 
-         //     console.log(11)
 
-         // }).catch(()=>{
 
-         //     // 执行失败的代码块
 
-         //     console.log(14)
 
-         // }) 
 
-         // console.log(10)
 
-         let book1 = new Promise((resolve,reject)=>{
 
-             console.log(1);
 
-             reject();
 
-         })
 
-         let book2 = new Promise((resolve,reject)=>{
 
-             console.log(2);
 
-             reject();
 
-         })
 
-         let book3 = new Promise((resolve,reject)=>{
 
-             console.log(3);
 
-             reject();
 
-         })
 
-         // Promise.all() 判断多个Promise 当传入的都成立 则成立
 
-         // Promise.all([book1,book2,book3]).then(()=>{
 
-         //     console.log('成功')
 
-         // }).catch(()=>{
 
-         //     console.log('失败')
 
-         // })
 
-         // Promise.race() 判断多个Promise 当传入的第一个成立 则成立
 
-         // Promise.race([book1,book2,book3]).then(()=>{
 
-         //     console.log('成功')
 
-         // }).catch(()=>{
 
-         //     console.log('失败')
 
-         // })
 
-         Promise.allSettled([book1,book2,book3]).then(()=>{
 
-             console.log('成功')
 
-         }).catch(()=>{
 
-             console.log('失败')
 
-         })
 
-         // book.then(()=>{
 
-         //     console.log("1")
 
-         // })
 
-         // book.catch(()=>{
 
-         //     console.log("12")
 
-         // })
 
-     </script>
 
- </body>
 
- </html>
 
 
  |