I have very long code and want to simplify it. I don't think so we can use string concatination to create different variable name. Is there any other way.
If(Something){
var a = some.Test1.x;
var b = some.Test1.y;
var c = some.Test1.z;
var d = some.Test1.p;
}
If(SomethingElse){
var a = some.Test2.x;
var b = some.Test2.y;
var c = some.Test2.z;
var d = some.Test2.p;
}
If(OneMore){
var a = some.Test3.x;
var b = some.Test3.y;
var c = some.Test3.z;
var d = some.Test3.p;
}
May be create some function like this, i know this is not right but anything similar to that.
function test(s){
a = some.s.x;
b = some.s.y;
c = some.s.z;
d = some.s.p;
}
o.foowitho["foo"]i.e. you can access thefoofield / member ofoeither by literal or by string ("foo"may be a string)