Last active
December 17, 2015 18:09
-
-
Save xtbl/5651191 to your computer and use it in GitHub Desktop.
JavaScript Module
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 myModule = (function (){ | |
var counter = 0; | |
function increment() { | |
counter += 1; | |
return counter; | |
} | |
function decrement() { | |
counter -= 1; | |
return counter; | |
} | |
function reset() { | |
counter = 0; | |
return counter; | |
} | |
return { | |
increment: increment, | |
decrement: decrement, | |
reset: reset | |
} | |
})() | |
myModule.increment(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment