-3

I am studying for JS coding interviews and just wanted a simple example of JS currying.

Does this example pass as currying?

    function curry(a){
     return function(b){
       return function(c){
         console.log(a+b+c)
      }
    }
  }
   curry(2)(2)(2)

1 Answers1

1

Absolutely! You have a function, returning a function, which therefor uses the previously passed parameter, achieving closure in the scope of the returned function.

XdertY
  • 21
  • 1
  • 3