Let's say I have a class
class Apple {
    constructor(color){
        this.state = {
            color: color
        }
    }
    getState(){
        return this.state;
    }
    setState(state){
        this.state = state;
    }
    turnGreen(){
        this.state.color = "Green";
    }
}
and if i do
let apple = new Apple("Red");
const originalState = apple.getState();
apple.turnGreen();             
console.log(apple.getState());   //{color: 'Green'}
apple.setState(originalState);
console.log(apple.getState());   //{color: 'Green'}
How come const originalState gets changed to 'Green' as well?
And is there any way to save the original state of the apple?
Thanks in advance
