Solution of Calc with Method Chaining
IntuitionTo initalize value and error and return value in end of every fucntion.ApproachWe using simple operators in add,multiply,in divide we use if else loop
# Intuition
To initalize value and error and return value in end of every fucntion.

# Approach
We using simple operators in add,multiply,in divide we use if else loop to return error if division by zero is happened and use operator /.After we use Marh pow method and return value.Finally,if we got the error we return it,and return the final value.

# Complexity
- Time complexity:
O(1)
- Space complexity:
O(1)

# Code
```javascript []
class Calculator {
    
    /** 
     * @param {number} value
     */
    constructor(value) {
        this.value = value
        this.error = null;
    }
    
    /** 
     * @param {number} value
     * @return {Calculator}
     */
    add(value){
        this.value += value
        return this
    }
    
    /** 
     * @param {number} value
     * @return {Calculator}
     */
    subtract(value){
        this.value -= value
        return this
    }
    
    /** 
     * @param {number} value
     * @return {Calculator}
     */  
    multiply(value) {
       this.value *= value
       return this
    }
    
    /** 
     * @param {number} value
     * @return {Calculator}
     */
    divide(value) {
    if(value == 0){
            this.error = "Division by zero is not allowed"
        }else{
            this.value /= value;
        }
        return this;

    }
    
    /** 
     * @param {number} value
     * @return {Calculator}
     */
    power(value) {
        this.value = Math.pow(this.value, value)
        return this
    }
    
    /** 
     * @return {number}
     */
    getResult() {
        if(this.error){
            return this.error;
        }
        return this.value;
    }
}
```
['JavaScript']