Created
March 20, 2016 03:21
-
-
Save JasonDeving/70a2df67f41d3c119c7d to your computer and use it in GitHub Desktop.
Simple library
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 counter = (function() { | |
var i = 0; | |
return { | |
get: function() { | |
return i; | |
}, | |
set: function(val) { | |
i = val; | |
}, | |
increment: function() { | |
i++; | |
} | |
} | |
})(); | |
console.log(counter.get()); | |
counter.set(5) | |
counter.increment() | |
console.log(counter.get()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment