Skip to content

Instantly share code, notes, and snippets.

@samandar-boymurodov
Created August 15, 2021 13:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save samandar-boymurodov/908e45d7c0202ed555cb4f15d52dfaad to your computer and use it in GitHub Desktop.
Save samandar-boymurodov/908e45d7c0202ed555cb4f15d52dfaad to your computer and use it in GitHub Desktop.
function sum (n) {
if (n === undefined) return 0
let inc = n
function add (k) {
if (k === undefined) return inc
inc += k
return add
}
return add
}
console.log(sum(1)(2)(3)())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment