This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| async function do() { | |
| await Promise.all([saladPromise, sEggPromise, burgerPromise]); | |
| return "done!"; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| async function PrepareLunch(){ | |
| let soup = PourSoup(); | |
| console.log("soup is ready"); | |
| let saladPromise = new Promise(function(resolve,reject){ | |
| resolve(PrepareSalad()); | |
| }); | |
| let sEggPromise = new Promise(function(resolve,reject){ | |
| resolve(PrepareScrambledEgg()); | |
| }); | |
| let burgerPromise = new Promise(function(resolve,reject){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| async function PrepareLunch(){ | |
| let soup = PourSoup(); | |
| console.log("soup is ready"); | |
| let salad = await PrepareSalad(); | |
| console.log("salad is ready"); | |
| let sEgg = await PrepareScrambledEgg(); | |
| console.log("scrambled egg is ready"); | |
| let burger = await FryBuns(2); | |
| AddVeggies(burger); | |
| DressBurger(burger); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| async function PrepareLunch(){ | |
| let soup = PourSoup(); | |
| console.log("soup is ready"); | |
| let salad = PrepareSalad(); | |
| console.log("salad is ready"); | |
| let sEgg = PrepareScrambledEgg(); | |
| console.log("scrambled egg is ready"); | |
| let burger = FryBuns(2); | |
| AddVeggies(burger); | |
| DressBurger(burger); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| newMobile.then((message)=>{ | |
| console.log(message); | |
| return newBike; | |
| }).then((message)=>{ | |
| console.log(message); | |
| return newCar; | |
| }).then((message)=>{ | |
| console.log(message); | |
| }).catch((message)=>{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Promise.all([newMobile,newBike,newCar]).then((messages)=>{ | |
| console.log(messages); | |
| }).catch((messages)=>{ | |
| console.log(messages); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let newBike = new Promise((resolve,reject)=>{ | |
| let wishToBuy = false; | |
| if(wishToBuy){ | |
| resolve({"Product":"Harley-Davidson Fat Boy","Price":"15L"}); | |
| } | |
| else{ | |
| reject({"reason":"Bike is not up to expectations"}); | |
| } | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| newMobile.then((message)=> | |
| { | |
| console.log("Ready to buy a "+message.Product+" having price "+message.Price); | |
| }).catch((message)=> | |
| { | |
| console.log(message.reason); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let newMobile = new Promise((resolve,reject)=>{ | |
| // searching for a new mobile (asynchronous operation) | |
| let wishToBuy = true; | |
| if(wishToBuy){ | |
| resolve({"Product":"iPhone 11","Price":"1L"}); | |
| } | |
| else{ | |
| reject({"reason":"Mobile is not up to expectations"}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| # coding: utf-8 | |
| # ## Perform Chi-Square test for Bank Churn prediction (find out different patterns on customer leaves the bank) . Here I am considering only few columns to make things clear | |
| # ### Import libraries | |
| # In[2]: |
NewerOlder