Skip to content

Instantly share code, notes, and snippets.

@Tribhuwan-Joshi
Created May 14, 2023 06:13
Show Gist options
  • Save Tribhuwan-Joshi/2e8615eb8fbf85f3dcd8c00d2773624e to your computer and use it in GitHub Desktop.
Save Tribhuwan-Joshi/2e8615eb8fbf85f3dcd8c00d2773624e to your computer and use it in GitHub Desktop.
Smooth currying in JS
const curry = function (fn){
return function currying(...args){
if(args.length >= fn.length ){
return fn(...args);
}
else {
return function(...args2){
return currying.apply(...args.concat(args2))
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment