Straightforward Solution
IntuitionMy first intuition was to use funcitons.map(fn => fn()), but realizing that I needed the functions to return in the correct order. I used functions.for
# Intuition
My first intuition was to use `funcitons.map(fn => fn())`, but realizing that I needed the functions to return in the correct order. I used `functions.forEach()` so that I could access the index of the function call. You can use the index to add the function result in the correct order to the array of results, then you can use the running count of `completedFn` to check whether you should return that array.

I did consider not having a `completedFn` to keep count of calls, in favor of using the index as the if condition to `resolve(resultsArr)`, but then it could return a partial results array if there was a hanging function that resolves only after the last function resolves. By adding an internal count, you ensure all functions run.

# Code
```javascript []
/**
 * @param {Array<Function>} functions
 * @return {Promise<any>}
 */
var promiseAll = function(functions) {
    let resultsArr = [];
    let completedFn = 0;

    return new Promise(function(resolve, reject) {
        functions.forEach((fn, index) => 
        fn().then(
            result => {
                resultsArr[index] = result;
                completedFn += 1
                if (completedFn == functions.length) {
                    resolve(resultsArr)
                }
            },
            error => reject(error)
        ))
    })
};

/**
 * const promise = promiseAll([() => new Promise(res => res(42))])
 * promise.then(console.log); // [42]
 */
```
['JavaScript']