function All(arr) { let len = arr.length; let results = [] for (let i = 0; i < len; i++) { if (i === len) { return resolve(results) } } } function a(num) { return new Promise((resolve) => { setTimeout(() => { resolve(num); }, 1000) }) } All([a(100), a(200)]);