diff --git a/source/_posts/异步JavaScript.md b/source/_posts/异步JavaScript.md index 579eabf..aa6bf05 100644 --- a/source/_posts/异步JavaScript.md +++ b/source/_posts/异步JavaScript.md @@ -212,3 +212,15 @@ function eat() { let orderPizza = new Promise(orderExecutor); orderPizza.then(eat).then(function () { console.log('Paying the bill!'); }); ``` + +# 还是异步 +```javascript +function orderExecutor(resolve, reject) { + console.log('Pizza ordered...'); + resolve("Here's your pizza!"); +} + +let orderPizza = new Promise(orderExecutor); +orderPizza.then(function (value) { console.log(value); }); +console.log("Waiting for my pizza!"); +```