18
Зачекайте, коли всі обіцянки завершаться, навіть якщо деякі відхиляться
Скажімо, у мене є набір Promises, які здійснюють мережеві запити, з яких один не зможе: // http://does-not-exist will throw a TypeError var arr = [ fetch('index.html'), fetch('http://does-not-exist') ] Promise.all(arr) .then(res => console.log('success', res)) .catch(err => console.log('error', err)) // This is executed Скажімо, я хочу зачекати, поки все це закінчиться, незалежно …