leetcodeSolution to some Leetcode problems written in C++ |
git clone git://git.dimitrijedobrota.com/leetcode.git |
Log | Files | Refs | README | LICENSE |
2629.js (246B)
0 /**
1 * @param {Function[]} functions
2 * @return {Function}
3 */
5 var compose = function(functions) {
6 return (x) => {
7 if (functions.length === 0) return x;
9 for (const func of functions.reverse())
10 x = func(x);
12 return x;
13 }
14 }