Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Calculator {
- constructor (value = 0) {
- this.value = value
- }
- add (value = 0) {
- this.value += value
- return this
- }
- multiply (value = 0) {
- this.value *= value
- return this
- }
- }
- const value = new Calculator(7)
- value
- .add(7)
- .add(10)
- .multiply(2)
- console.log(value.value)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement