Typescript solution beats 98% users
\n\n\n# Code\n\nclass Calculator {\n    \n    constructor(private value: number) {\n        return this;\n    }\n    \n    add(value: number): Calculator {\n   
![image.png](https://assets.leetcode.com/users/images/3c129b7f-589d-4a1e-8e95-dd12d0087d65_1719039245.6683645.png)\n\n\n# Code\n```\nclass Calculator {\n    \n    constructor(private value: number) {\n        return this;\n    }\n    \n    add(value: number): Calculator {\n        this.value = this.value + value;\n        return this;\n    }\n    \n    subtract(value: number): Calculator {\n        this.value = this.value - value;\n        return this;\n    }\n    \n    multiply(value: number): Calculator {\n        this.value = this.value * value;\n        return this;\n    }\n    \n    divide(value: number): Calculator {\n        if (value === 0) {\n            throw Error("Division by zero is not allowed")\n        }\n        this.value = this.value / value;\n        return this;\n    }\n    \n    power(value: number): Calculator {\n        this.value = this.value ** value;\n        return this;\n    }\n    \n    getResult(): number {\n        return this.value\n    }\n}\n```
['TypeScript']