by
40 5

Promise.all for Rejections and Resolves

Always call then, even when one promise rejects
Copy Embed Code
<iframe id="embedFrame" style="width:600px; height:300px;"
src="https://www.snip2code.com/Embed/1825494/Promise-all-for-Rejections-and-Resolves?startLine=0"></iframe>
Click on the embed code to copy it into your clipboard Width Height
Leave empty to retrieve all the content Start End
// https://davidwalsh.name/promises-results Promise.all([ // Resolves Promise.resolve(1), // Rejects after 2 seconds new Promise((resolve, reject) => setTimeout(() => reject(1), 2000)) ].map(p => p.catch(() => undefined))).then(() => console.log('done!'));
If you want to be updated about similar snippets, Sign in and follow our Channels

blog comments powered by Disqus