ES6中的Promise.resolve()的作用
var foo = { then: (resolve, reject) => resolve('foo') }; var resolved = Promise.resolve(foo); 相当于 var resolved = new Promise((resolve, reject) => { foo.then(resolve, reject) }); resolved.then((str) => console.log(str);//foo )
原文地址:https://segmentfault.com/q/1010000005330351