Here’s a rephrased version of the content while preserving its original meaning: ```javascript function promiseAll(promises) { return new Promise((resolve, reject) => { let resultArr = []; let promisesCount = promises.length; let fulfilledPromises = 0; promises.forEach((promise, index) => { Promise.resolve(promise).then(result => { resultArr[index] = result; fulfilledPromises++; if (fulfilledPromises === promisesCount) { resolve(resultArr); } }, reject); }); }); } ``` In this example, we begin by creating a new Promise. We initialize two variables: `resultArr`, which will store the resolved values, and `promisesCount`, which holds the total number of input promises. The `fulfilledPromises` variable keeps track of how many promises have been resolved. For each promise in the input array, we invoke `Promise.resolve()`. If a promise is successfully fulfilled, we store its result in `resultArr` at the correct index and increase the count of `fulfilledPromises`. Once all promises are fulfilled, we resolve the outer promise with `resultArr`.