en.javascript.info/archive/promise/thenable2.js
2017-05-01 11:44:56 +03:00

19 lines
371 B
JavaScript

'use strict';
new Promise()
.then(result => {
return {
then(resolve, reject) {
setTimeout(() => resolve("two"), 1000);
}
};
})
.then(result => {
console.log("HERE", result);
return result;
})
.then(console.log)
.catch(err => console.error("ERROR", err));
// https://tc39.github.io/ecma262/#sec-promise-resolve-functions