Polyfill for promise.all
\n\n/**\n * @param {Array<Function>} functions\n * @return {Promise<any>}\n */\nvar promiseAll = async function(functions) {\n    const result = [];\n    let re
\n```\n/**\n * @param {Array<Function>} functions\n * @return {Promise<any>}\n */\nvar promiseAll = async function(functions) {\n    const result = [];\n    let resolvedCount = 0;\n    if(functions.length === 0){\n        return Promise.resolve(functions);\n    }\n   return new Promise((resolve, reject) => {\n       functions.forEach((fn, index) => {\n           fn()\n            .then((res) => {\n                result[index] = res;\n                resolvedCount++;\n                if(resolvedCount === functions.length){\n                    resolve(result);\n                }\n            })\n            .catch((err) => {\n                reject(err);\n            });\n       });\n   });\n};\n\n/**\n * const promise = promiseAll([() => new Promise(res => res(42))])\n * promise.then(console.log); // [42]\n */\n```
['JavaScript']