批改状态:合格
老师批语:
<!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>// fetchfetch('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>
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号