sipdeey man! parallel universe of madness!
IntuitionApproachComplexity
Time complexity:

Space complexity:
Code
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->

# Approach
<!-- Describe your approach to solving the problem. -->

# Complexity
- Time complexity:
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity:
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```javascript []
/**
 * @param {Array<Function>} functions
 * @return {Promise<any>}
 */
var promiseAll = function(functions) {
    return new Promise((resolve,reject)=>{
        const resolveValues = [];
        let hasRejected = false;
        let resolveCount = 0;
        functions.forEach((promiseFn,index)=>{
            promiseFn()
                .then((value)=>{
                    if(!hasRejected) {
                        resolveValues[index] = value;
                        resolveCount++;

                        if(resolveCount === functions.length){
                            resolve(resolveValues)
                        }
                    }
                })
                .catch((error)=>{
                    if(!hasRejected){
                        hasRejected = true;
                        reject(error)
                    }
                })
        }) 
    });
};

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