JavaScript
Promise
- July 6, 2017
- Sophie He
In ES6, Promise
is an improvement of traditional callback. We always put the async request in new Promise()
, it will wait until you get the result for resolve or reject. While if you put the async function in then()
, whatever you return in that async request, then()
will return Promise.resolve(undefined)
as async callback is just local function.