S
stephen2017
Guest
Hi all,
Going in a different direction to try to solve a problem I have. Is there a way to dynamically retrieve a variable. Will explain what I need to do.
In my creation code I have this.
var question2answer = obj_cat2; // this is setting an object to one of a set of questions. There are 10 questions at the moment but want to add more.
What I need to do is get an obj variable to = that obj_cat2 so I can create an instance of that object. this is the way I am doing it but I am going about it the wrong way.
obj = "question"+m[0]+"answer" // m[0] being a random number from an array so it selects a random question.
I think it is just setting obj to a string though and I need it to pull that variable as above. Any help is appreciated as this is buggin me now lol.
TIA
Going in a different direction to try to solve a problem I have. Is there a way to dynamically retrieve a variable. Will explain what I need to do.
In my creation code I have this.
var question2answer = obj_cat2; // this is setting an object to one of a set of questions. There are 10 questions at the moment but want to add more.
What I need to do is get an obj variable to = that obj_cat2 so I can create an instance of that object. this is the way I am doing it but I am going about it the wrong way.
obj = "question"+m[0]+"answer" // m[0] being a random number from an array so it selects a random question.
I think it is just setting obj to a string though and I need it to pull that variable as above. Any help is appreciated as this is buggin me now lol.
TIA