Promise.all function
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```javascript []\n/**\n * @param {Array<Function>} functions\n * @return {Promise<any>}\n */\nvar promiseAll = function (functions) {\n    const promisesCount = functions.length\n    let resolvedPromises = 0\n    const promisesResponses = []\n\n       return new Promise((resolve, reject) => {\n            functions.map((promise, index) => promise().then(response => {\n                ++resolvedPromises\n                promisesResponses[index] = response\n\n                if (resolvedPromises === promisesCount) resolve(promisesResponses)\n            }).catch(error => reject(error)))\n        })\n    \n};\n\n/**\n * const promise = promiseAll([() => new Promise(res => res(42))])\n * promise.then(console.log); // [42]\n */\n```
['JavaScript']