0

I have a object called story and a variable called scene, i'm trying to make the scene variable add onto the object call. What i mean is instead of

myobject.myfunction

i want to be able to use

myobject.myvariable

my variable will link to my function but the variable changes at certain times. Is there a way i can do this, because when i try it adds it as a function call.

Hopefully you understand what i mean but it is quite difficult to explain. Thanks in advanced.

1 Answer 1

1

These are equivalent:

o.myFn();

o['myFn']();

So you can do:

myobject[myvariable]()

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.