Created
January 16, 2019 14:34
-
-
Save ms314006/34b3748dcd83707c3734b85233d48311 to your computer and use it in GitHub Desktop.
This file contains 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
const newPromise = new Promise((resolve, reject)=>{ | |
setTimeout(()=>{ | |
if(Math.random() > 0.5){ | |
resolve('changed') | |
} | |
else{ | |
reject('error') | |
} | |
}, 3000) | |
}).then((data)=>{ | |
console.log(data) | |
}).catch((error)=>{ | |
console.log(error) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment