-
-
Save isaacs/7c5a3386a0a7acc2f36fc061700a0b9e to your computer and use it in GitHub Desktop.
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
class Foo { | |
bar = 1 | |
#baz = 0 | |
get bazzer () { | |
return this.#baz | |
} | |
get barrier () { | |
this.#baz ++ | |
return this.bar | |
} | |
} | |
const f = new Foo() | |
console.log('baz!', f.bazzer) | |
console.log('bar!', f.barrier) | |
console.log('baz!', f.bazzer) | |
console.log(f) | |
/* output: | |
baz! 0 | |
bar! 1 | |
baz! 1 | |
Foo { bar: 1 } | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment