用一个简单的例子来说明,await到底在等待什么
求代码的打印顺序
function testAsy(x) {
  return new Promise((resolve) => {
    setTimeout(() => {
      resolve(x);
    }, 3000);
  });
}
async function testAwt() {
  console.log("async开始执行");// 最先打印
  let result = await testAsy("hello world");
  console.log(result); // 3秒钟之后出现hello world
  console.log("cuger"); // 3秒钟之后出现cug
}
testAwt();
console.log("cug"); //第二输出cug

规律总结
这就是 await 必须用在 async 函数中的原因。async 函数调用不会造成阻塞,它内部所有的阻塞都被封装在一个 Promise 对象中异步执行。await 暂停当前 async 的执行,所以’cug’'最先输出,hello world’和‘cuger’是 3 秒钟后同时出现的。
再来一题
    const URL = "http://geek.itheima.net/v1_0/channels";
    async function fetchChannelList() {
      console.log("async开始执行");
      const res = await fetch(URL);
      console.log("res", res);
      console.log("async函数结束了");
    }
    fetchChannelList();
    console.log("函数外边");




















