同步:客户端向服务器端发送请求的时候,用户不能进行其他的操作
烧水完毕之后 才可以看书

异步:客户端向服务器端发送请求的时候,用户可以进行其他的操作
烧水的同时 可以看书

以及对资源的操作肯定是异步的
**

定时器异步场景

  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <title>Document</title>
  7. </head>
  8. <body>
  9. <script>
  10. console.log(1);
  11. setTimeout(()=>{
  12. console.log("http")
  13. },1000)
  14. console.log(2);
  15. </script>
  16. </body>
  17. </html>