Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
JS Keyword Getters And Setters
var obj = {
fooVal: 'this is the value of foo',
get foo() {
return this.fooVal;
set foo(val) {
this.fooVal = val;
// "this is the value of foo" = 'hello';
// "hello"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.