2629.js (246B)
1 /** 2 * @param {Function[]} functions 3 * @return {Function} 4 */ 5 6 var compose = function(functions) { 7 return (x) => { 8 if (functions.length === 0) return x; 9 10 for (const func of functions.reverse()) 11 x = func(x); 12 13 return x; 14 } 15 }