PromiseAll
Code\n\n/**\n * @param {Array<Function>} functions\n * @return {Promise<any>}\n */\nvar promiseAll = function (functions) {\n    return new Promise((resolve, re
# Code\n```\n/**\n * @param {Array<Function>} functions\n * @return {Promise<any>}\n */\nvar promiseAll = function (functions) {\n    return new Promise((resolve, reject) => {\n        let res = []\n        let count = 1\n        functions.forEach((promise, index) => {\n            promise().then((data) => {\n                res[index] = data\n                if (functions.length === count) {\n                    resolve(res)\n                }\n                count++\n            }).catch((err) => reject(err))\n        })\n    })\n};\n\n/**\n * const promise = promiseAll([() => new Promise(res => res(42))])\n * promise.then(console.log); // [42]\n */\n```
['JavaScript']