What do you want to save?
Add Code snippet
New code examples
-
Javascript 2021-09-06 19:38:04
promise.allsettled polyfill node
Promise.myAll = function (promises) { var count = promises.length var result = new Array(count).fill(false) return new Promise((resolve, reject) => { var checkIfDone = () => { if (--count === 0) resolve(result) } promises.f... Add solution -
Javascript 2021-09-03 15:19:02
promise catch javascript
//create a Promise var p1 = new Promise(function(resolve, reject) { resolve("Success"); }); //Execute the body of the promise which call resolve //So it execute then, inside then there's a throw //that get capture by catch p1.then(function(va... Add solution -
Other 2021-08-31 12:43:01
sending value to promise
var some_function = function(username, password) { return new Promise(function(resolve, reject) { /*stuff using username, password*/ if ( /* everything turned out fine */ ) { resolve("Stuff worked!"); } else { reject(Error(&q... Add solution