53 lines
885 B
HTML
53 lines
885 B
HTML
<!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>
|
||
// 从上到下 从左到右
|
||
// 同步
|
||
// console.log("start");
|
||
|
||
// // N
|
||
|
||
|
||
// console.log("end");
|
||
|
||
|
||
// 异步
|
||
// 定时器, Ajax, 读取文件,
|
||
|
||
console.log("start");
|
||
|
||
|
||
// 异步代码
|
||
setTimeout(() => {
|
||
console.log("内容");
|
||
}, 0);
|
||
|
||
throw 'stop'
|
||
|
||
console.log("end");
|
||
|
||
|
||
</script>
|
||
|
||
</body>
|
||
|
||
</html>
|
||
|
||
|
||
<!--
|
||
如何区分异步API与同步API
|
||
|
||
看 这个API 需不需要 等待时间
|
||
看 这个API 需不需要 等待时间是确定的吗(不是人为确定 是机器内部确定)
|
||
|
||
--> |