async await

它作为一个关键字放到函数前面,用于表示函数是一个异步函数,因为async就是异步的意思, 异步函数也就意味着该函数的执行不会阻塞后面代码的执行。 写一个async 函数

async function fn() {
  return 'hello world';
}
取到返回值 fn().then((res)=>{console.log(res)})
async的返回值是一个promise对象。

resolve()通知



resolve(参数)会把函数返回值通过.then()
原文地址:https://www.cnblogs.com/binglove/p/10527466.html