promise 和 async await 的区别?
Async/await 和 Promises 都是处理异步任务
Async/await 代码看起来像同步代码,不需要像 Promise 一样需要些 then
使用 async|await 时,在函数前有一个关键字 async,await 关键字只能在使用 async 定义的函数中使用。
Promise 中不能自定义使用 try/catch 进行错误捕获,但是在 Async/await 中可以像处理同步代码处理错误
Async/await 是建立在 Promises 上的,可以认为 async / await 就是 Promise 的语法糖。