Master JavaScript with This Powerful Chainable Calculator !
Intuition\nThe idea behind this problem is to implement a simple, chainable calculator that performs basic arithmetic operations. The goal is to allow users to 
# Intuition\nThe idea behind this problem is to implement a simple, chainable calculator that performs basic arithmetic operations. The goal is to allow users to perform multiple operations in a sequence while maintaining code simplicity and readability.\n\n# Approach\nWe will define a class **Calculator** that initializes with a value. Each arithmetic operation (**add, subtract, multiply, divide, and power**) will modify the internal **value** and return the instance itself, allowing method chaining. The **divide** function will handle division by zero by throwing an appropriate error. Finally, a **getResult** method will return the current value.\n\n# Complexity\n- Time complexity:\nEach operation (addition, subtraction, multiplication, division, exponentiation) is performed in constant time. Hence, the time complexity for each operation is: \uD835\uDC42(1)\n\n- Space complexity:\nSince the calculator only stores a single value, the space complexity is also: \uD835\uDC42(1)\n\n# Code\n```javascript []\nclass Calculator {\n\n    constructor(value) {\n        this.value = value;\n    }\n\n    add(value) {\n        this.value += value;\n        return this;\n    }\n\n    subtract(value) {\n        this.value -= value;\n        return this;\n    }\n\n    multiply(value) {\n        this.value *= value;\n        return this;\n    }\n    \n    divide(value) {\n        if (value === 0) {\n            throw new Error(\'Division by zero is not allowed\');\n        }\n        this.value /= value;\n        return this;\n    }\n    \n    power(value) {\n        this.value = Math.pow(this.value, value);\n        return this;\n    }\n    \n    getResult() {\n        return this.value;\n    }\n}\n```
['JavaScript']