Clear ✅TypeScript using chaining by returning "this"
Intuition\n\n\n# Code\n\nclass Calculator {\n    #result: number\n    constructor(value: number) {\n        this.#result = value\n    }\n    \n    add(value: nu
# Intuition\n\n\n# Code\n```\nclass Calculator {\n    #result: number\n    constructor(value: number) {\n        this.#result = value\n    }\n    \n    add(value: number): Calculator {\n        this.#result += value\n        return this\n    }\n    \n    subtract(value: number): Calculator {\n        this.#result -= value\n        return this\n    }\n    \n    multiply(value: number): Calculator {\n        this.#result *= value\n        return this\n    }\n    \n    divide(value: number): Calculator {\n        if (value === 0) throw new Error("Division by zero is not allowed")\n        this.#result /= value\n        return this\n    }\n    \n    power(value: number): Calculator {\n        this.#result = Math.pow(this.#result, value)\n        return this\n    }\n    \n    getResult(): number {\n        return this.#result\n    }\n}\n```
['TypeScript']