1 let promise = new Promise(function(resolve, reject) { 2 console.log('Promise'); 3 resolve(); 4 }); 5 6 promise.then(function() { 7 console.log('resolved.'); 8 }); 9 10 console.log('Hi!'); 11 12 // Promise 13 // Hi! 14 // resolved
- promise对象被Promise构造函数创建了出来
- 它调用了then函数
- 给then传入的参数是一个函数所返回的值