create json property dynamically
Hi,
First, I am not sure where should I post this question. This is actually general javascript question, however it might be any solution using jQuery.
I have code below
-
var options = {
groups: {
mygroup: {
shape: 'circle',
fontColor: 'red',
fontSize: 18
}
// add more groups here
}
};
Is there any possibility to assign
mygroup dynamically?
for example:
something like I assign mygroup in myvariable
var myvariable = mygroup;
then I replace mygroup with variable myvariable. Like this
-
var options = {
groups: {
myvariable: {
shape: 'circle',
fontColor: 'red',
fontSize: 18
}
// add more groups here
}
};
However I want this "
myvariable " will be intepreted as anything inside the variable. In this case "
mygroup ". Is that any solution for that?
I hope my question is clear and thanks for your help :)