Object with methods implementation with and without class definition

class O {
  constructor() {
    this.summ = 0
  }
  one(n) {
    this.summ += n
    return this
  }
  two(t) {
    this.summ += t
    return this
  }
  get() {
    return this.summ
  }
}

const obj = {
  summ: 0,
  one: function (n) {
    this.summ += n
    return this
  },
  two: function (t) {
    this.summ += t
    return this
  },
  get: function () {
    return this.summ
  }
}

const o = new O()
o.one(10).two(20) //30

obj.one(10).two(20)//30

As you can see above, you can use any approach you want. Which approach to use is up to you !