Having an object of this form:
myObj = {
    id: 1,
    values: {
        internal: {
                myProp1: true
                myProp2: true
            },
        external: {
                myProp1: true
                myProp2: true
            }
    }
};
I want to be able that when I choose an option, internal or external to be able to set myProp1 to false only for the one option I chose.
In this case, if I choose internal the object should look like this:
myObj = {
    id: 1,
    values: {
        internal: {
                myProp1: false
                myProp2: true
            },
        external: {
                myProp1: true
                myProp2: true
            }
    }
};
I tried to do it like but something I do wrong:
    Object.keys(myObj).forEach(element => {
        if(element === "values") {
            element.forEach(innerElement => {
                if(innerElement === "internal") {
                    innerElement.myProp1= false;
                }
            });
        }
    });
Any suggestions?
 
     
     
    