Skip to content

Commit

Permalink
Merge pull request hemanth#172 from iangregor/patch-1
Browse files Browse the repository at this point in the history
Add line after code block to fix inline code
  • Loading branch information
hemanth authored Nov 8, 2017
2 parents 5fb5b46 + bbd80f9 commit e47f3b9
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ const addTo = x => y => x + y
var addToFive = addTo(5)
addToFive(3) // returns 8
```

The function `addTo()` returns a function(internally called `add()`), lets store it in a variable called `addToFive` with a curried call having parameter 5.

Ideally, when the function `addTo` finishes execution, its scope, with local variables add, x, y should not be accessible. But, it returns 8 on calling `addToFive()`. This means that the state of the function `addTo` is saved even after the block of code has finished executing, otherwise there is no way of knowing that `addTo` was called as `addTo(5)` and the value of x was set to 5.
Expand Down

0 comments on commit e47f3b9

Please sign in to comment.