Skip to content

Instantly share code, notes, and snippets.

@Kadajett
Last active January 26, 2018 22:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Kadajett/e7768308b1151fee9687f328c48533fd to your computer and use it in GitHub Desktop.
Save Kadajett/e7768308b1151fee9687f328c48533fd to your computer and use it in GitHub Desktop.
Increment an integer on GET
var i = 1;
Object.defineProperty(window, 'n' , {
get() {
return i ++;
}
})
// n == 1
// n == 2
// n == 3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment