From a09cbdd677540778836fa6a684e26d932a9701de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julian=20T=C3=B6lle?= Date: Tue, 12 Dec 2017 22:09:31 +0100 Subject: [PATCH] asyncJs: fix Promise.all Array param --- AsynchronousJavascript/index.html | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/AsynchronousJavascript/index.html b/AsynchronousJavascript/index.html index 91091ad..3ddb36e 100644 --- a/AsynchronousJavascript/index.html +++ b/AsynchronousJavascript/index.html @@ -163,10 +163,10 @@

               // Parallel Execution
-              Promise.all(
+              Promise.all([
                 fetch("https://api.coindesk.com/v1/bpi/currentprice.json"),
                 fetch("https://api.coindesk.com/v1/bpi/historical/close.json")
-              ).then(([currentPrice, historicalPrices]) =>
+              ]).then(([currentPrice, historicalPrices]) =>
                 console.log(currentPrice, historicalPrices)
               ).catch(err => console.error(err));
             
@@ -177,7 +177,7 @@

               // Variable Passthrough
               User.findOne({ name: "realDonaldTrump" })
-              .then(user => Promise.all(user, Tweets.find({ user_id: user.id })))
+              .then(user => Promise.all([user, Tweets.find({ user_id: user.id })]))
               .then(([user, tweets]) => {
                 console.log(`User ${user.name} has ${tweets.length} tweets`);
               });
@@ -221,10 +221,10 @@
               // Parallel Execution
               async function getBtcData() {
                 try {
-                  const [currentPrice, historicalPrices] = await Promise.all(
+                  const [currentPrice, historicalPrices] = await Promise.all([
                     fetch("https://api.coindesk.com/v1/bpi/currentprice.json"),
                     fetch("https://api.coindesk.com/v1/bpi/historical/close.json")
-                  )
+                  ])
                   
                   console.log(currentPrice, historicalPrices)
                 } catch (err) {