Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

柯里化函数 #31

Open
Saikikoko opened this issue Mar 14, 2021 · 0 comments
Open

柯里化函数 #31

Saikikoko opened this issue Mar 14, 2021 · 0 comments
Labels
Js knowledge of Javascript

Comments

@Saikikoko
Copy link
Owner

function curry(fn) {
  return function curried(...args) {
    if (args.length < fn.length) {
      return function(...args2) {
        return curried.apply(this, args.concat(args2))
      } 
    } else {
      return fn.apply(this, args)
    }
  }
}
@Saikikoko Saikikoko added the Js knowledge of Javascript label Mar 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Js knowledge of Javascript
Projects
None yet
Development

No branches or pull requests

1 participant