class Mymath { constructor(options) { console.log(options); this.num = options; } add(num) { this.num += num; return this; } mul(num) { this.num *= num; return this; } sub(num) { this.num -= num; return this; } run() { return this.num; } } const result = new Mymath(2).add(5).mul(2).sub(7).run(); console.log(result);