Created
October 17, 2013 19:21
-
-
Save AimeeKnight/7030693 to your computer and use it in GitHub Desktop.
JavaScript Revealing Module Pattern
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var jspy = (function() { | |
var _count = 0; | |
var incrementCount = function() { | |
_count++; | |
}; | |
var resetCount = function() { | |
_count = 0; | |
}; | |
var getCount = function() { | |
return _count; | |
}; | |
return { | |
add: incrementCount, | |
reset: resetCount, | |
get: getCount | |
}; | |
})(); | |
jspy.get(); // 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment