Skip to content

Latest commit

 

History

History
13 lines (11 loc) · 347 Bytes

README.md

File metadata and controls

13 lines (11 loc) · 347 Bytes

JS-Examples

Collections of JS examples

Curry implementation using recursion

const curry = (fn, ...args) => fn.length === args.length ?
  fn(...args) : (...remainingArgs) => curry(fn, ...args, ...remainingArgs);

const add = (a,b) => a + b;
console.log(curry(add, 1, 2))
console.log(curry(add, 1)(2))
console.log(curry(add)(1)(2))