Pipe Operator JS

Run Settings
LanguageJavaScript
Language Version
Run Command
function add(x) { return x + 1 } function double(x) { return x * 2 } function triple(x) { return x * 3 } function pipe(...fns) { return function(val) { return fns.reduce((res, func) => { return func(res) },val) } } const addDoubleTriple = pipe(add, double, triple) console.log(addDoubleTriple(3)) // addDoubleTriple(3)
Editor Settings
Theme
Key bindings
Full width
Lines