Skip to content

Instantly share code, notes, and snippets.

@bradfordlemley
Last active May 24, 2019 17:27
Show Gist options
  • Save bradfordlemley/15bda44641de41e1e286e0076b8e0b2f to your computer and use it in GitHub Desktop.
Save bradfordlemley/15bda44641de41e1e286e0076b8e0b2f to your computer and use it in GitHub Desktop.
Vanilla counter library
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