Skip to content

Instantly share code, notes, and snippets.

@ZakriaJanjua
Created August 13, 2023 18:38
Show Gist options
  • Save ZakriaJanjua/494a69776e1eb3c7ae2b3148f59b897a to your computer and use it in GitHub Desktop.
Save ZakriaJanjua/494a69776e1eb3c7ae2b3148f59b897a to your computer and use it in GitHub Desktop.
A javascript function that can take infinite closures
function multiply(params) {
return function(args) {
if (args) {
return multiply(params*args)
} else {
return params
}
}
}
console.log(multiply(2)(3)(5)())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment