Closed a-c-sreedhar-reddy closed 5 years ago
Yes, there are two functions, and thus two closures, each closed over the same shared state.
Then is this statement
a closure associates a single function with a set of state, whereas an object holding the same state can have any number of functions to operate on that state
which I found in this book wrong?
I think you're reading too much into the statement. The intent is not to imply that a function closure is mutually exclusive of another function closure. It's to point out that closure is over private state, so only the function(s) closed over it can access it, where as an object is public state and any function at any time can access it.
Thank for the book.:heart:
I also heard FP helps scalability. If possible can you just brief about that in the book.
This statemet is not correct I guess.
Here two functions are assosiated with a state. Correct me if my understanding is wrong.