Skip to content

Instantly share code, notes, and snippets.

@anil-pace
Created August 13, 2020 07:03
Show Gist options
  • Select an option

  • Save anil-pace/4132829b62bcdc8ee4c90e60b2a827df to your computer and use it in GitHub Desktop.

Select an option

Save anil-pace/4132829b62bcdc8ee4c90e60b2a827df to your computer and use it in GitHub Desktop.
var calculator = {
result: 0,
one: function () {
this.result = this.result + 1;
return this;
},
three: function () {
this.result = this.result + 3;
return this;
},
five: function () {
this.result = this.result + 5;
return this;
},
value: function () {
console.log(this.result);
}
}
calculator.one().three().five().value();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment