Skip to content

Instantly share code, notes, and snippets.

@vishnuroshan
Created July 5, 2023 12:09
Show Gist options
  • Select an option

  • Save vishnuroshan/c791a34623afdc6689a844beb4f16508 to your computer and use it in GitHub Desktop.

Select an option

Save vishnuroshan/c791a34623afdc6689a844beb4f16508 to your computer and use it in GitHub Desktop.
const sum = (a) => (b) => b === undefined ? a : sum(a+b);
const arr = []
arr[0] = sum(1)(2)(3)(); // output: 6
arr[1] = sum(1)(2)(3)(1)(1)(2)(2)(10)(); // output: 22
console.log(arr);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment