Created
September 2, 2020 13:37
-
-
Save Nas10ka/799c2e34667f1fa8f3d7f4dc4ce4fb6a to your computer and use it in GitHub Desktop.
JS Bin // source https://jsbin.com/denowefipi
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<script id="jsbin-javascript"> | |
console.clear(); | |
const promises = []; | |
var p1 = Promise.resolve(3); | |
var p2 = Promise.reject('REJECTEd'); | |
var p3 = new Promise((resolve, reject) => { | |
setTimeout(resolve, 100, "foo"); | |
}); | |
promises.push(p1); | |
promises.push(p3); | |
promises.push(p2); | |
Promise.all(promises).then(values => { | |
console.log("PROMISE ALL ", values); | |
}); | |
promises.push(p2); | |
Promise.allSettled(promises).then(values => { | |
console.log("ALL SETTLED ", values.map(data => data.value)); | |
}); | |
</script> | |
<script id="jsbin-source-javascript" type="text/javascript">console.clear(); | |
const promises = []; | |
var p1 = Promise.resolve(3); | |
var p2 = Promise.reject('REJECTEd'); | |
var p3 = new Promise((resolve, reject) => { | |
setTimeout(resolve, 100, "foo"); | |
}); | |
promises.push(p1); | |
promises.push(p3); | |
promises.push(p2); | |
Promise.all(promises).then(values => { | |
console.log("PROMISE ALL ", values); | |
}); | |
promises.push(p2); | |
Promise.allSettled(promises).then(values => { | |
console.log("ALL SETTLED ", values.map(data => data.value)); | |
});</script></body> | |
</html> |
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
console.clear(); | |
const promises = []; | |
var p1 = Promise.resolve(3); | |
var p2 = Promise.reject('REJECTEd'); | |
var p3 = new Promise((resolve, reject) => { | |
setTimeout(resolve, 100, "foo"); | |
}); | |
promises.push(p1); | |
promises.push(p3); | |
promises.push(p2); | |
Promise.all(promises).then(values => { | |
console.log("PROMISE ALL ", values); | |
}); | |
promises.push(p2); | |
Promise.allSettled(promises).then(values => { | |
console.log("ALL SETTLED ", values.map(data => data.value)); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment