Correcting teacher:PHPz
Correction status:qualified
Teacher's comments:
<!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>fetch / async / await </title>
</head>
<body>
<script>
// fetch
fetch('https://jsonplaceholder.typicode.com/todos/9')
.then((Response) => Response.json())
.then((json => console.log(json)))
// async await function 前面假async,使它变成一个异步函数
async function getUser(){
let url = 'https://jsonplaceholder.typicode.com/todos/8'
const response = await fetch(url)
const result = await response.json()
console.log(result)
}
</script>
</body>
</html>