I have this structure:
var data = {
'horizontal':{
'static':[1,3,5,7,9],
'dynamic':[2,4,6,8]
},
'vertical':{
'static':[1,3,5,7,9],
'dynamic':[2,4,6,8]
}
};
I have this HTML objects:
Direction:
<select id="direction">
<option value="horizontal">Horizontal</option>
<option value="vertictal">Vertictal</option>
</select>
Type:
<select id="mytype">
<option value="static">Static</option>
<option value="dynamic">Dynamic</option>
</select>
Can I access to the data.horizontal.static[2]
somehow like this?
var result = data.[ $('#direction').val() ].[ $('#mytype').val() ][2];
Is there any way?