-2

If I write something like below

function sum(x){
   return function(y){
       return function(z){
             return x + y + z;
}
}
}

and call it like sum(2)(3)(4) // output is 8

can we call the above function, an example of closure within a closure ???

user2225263
  • 277
  • 4
  • 15

1 Answers1

0

Yes, it is an example of closure within a closure.

user2225263
  • 277
  • 4
  • 15