I have following code in JavaScript. I would like to execute some logic when any property in the object sizeLogic
is changed. Specifically, I would like to change all other properties to false, when any one of these properties is set to true.
Question: How would I achieve this? I am not sure if this is even possible in JavaScript without writing methods like set_leftTop(x)
, so that within the method we could write the custom logic.
var sizeLogic = {
leftTop: true,
leftBottom: false,
rightTop: false,
rightBottom: false
}