同步:客户端向服务器端发送请求的时候,用户不能进行其他的操作
烧水完毕之后 才可以看书
异步:客户端向服务器端发送请求的时候,用户可以进行其他的操作
烧水的同时 可以看书
以及对资源的操作肯定是异步的
**
定时器异步场景
<!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>
<script>
console.log(1);
setTimeout(()=>{
console.log("http")
},1000)
console.log(2);
</script>
</body>
</html>