Help with setting a variable to another variables child

Im trying to make a script which does this this.define(variable1.variable2) but it instead takes my variable as a child of variable1 to refer to (which does exist but I would want it to point to the valu that variable2 stores). How would I go about doing this?

From your code it looks like you are trying to access an object property based on a variable (variable2). If that is the case it should be this.define(variable1[variable2]).

If you want to learn more about accessing the properties of an object, MDN has a good article about it here:

1 Like

Thank you for the info! I’ll close this now.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.