Skip to content

Instantly share code, notes, and snippets.

@gsampath127
Created February 11, 2020 16:19
Show Gist options
  • Save gsampath127/eaf683eed0ff7a19b58cedb17e1b98d4 to your computer and use it in GitHub Desktop.
Save gsampath127/eaf683eed0ff7a19b58cedb17e1b98d4 to your computer and use it in GitHub Desktop.
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"});
}
});
let newCar = new Promise((resolve,reject)=>{
let wishToBuy = false;
if(wishToBuy){
resolve({"Product":"Volkswagen","Price":"20L"});
}
else{
reject({"reason":"Car is not up to expectations"});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment