I want to define a property to some namespace depending on another property. The following is my attempt to assign someNameSpace.x2 based on someNameSpace.x1:
someNameSpace = {
x1: 100,
x2: x1 * 0.5,
};
but it fails. What is the correct way to do this?
You can’t do that because
x1hasn’t been defined yet in the scope.