Last active
May 24, 2019 17:27
-
-
Save bradfordlemley/15bda44641de41e1e286e0076b8e0b2f to your computer and use it in GitHub Desktop.
Vanilla counter 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
function createCounter() { | |
let counter = 0; | |
return { | |
get counter() { return counter }, | |
increment() { counter = counter + 1}, | |
decrement() { counter = counter - 1}, | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment