r/javascript • • Dec 19 '15

4 JavaScript Design Patterns You Should Know

https://scotch.io/bar-talk/4-javascript-design-patterns-you-should-know
1 Upvotes

6 comments sorted by

View all comments

4

u/Gilgw Dec 19 '15

I don't see any difference between the module pattern and the revealing module pattern examples. The privacy of local variables is maintained in both cases, it seems?

3

u/[deleted] Dec 19 '15

In the examples given, there is no difference. However in the revealing module pattern you can pick and choose which items you eventually "reveal" in the returned object. The items you choose not to reveal are then "private" as it were.