I'm having a problem with accessing element inside an array. Here is a sample code:
var Core = {
customNames: {
'1': [ 'Power Off' ],
'21': [ 'TV', 'Bedroom' ]
},
render: function() {
$.each( Core.devices.result, function( i, obj ) {
var name = Core.customNames[obj.idx][1] ? Core.customNames[obj.idx][1] : obj.Name;
});
}
};
obj.idx is a variable, let say with value 21. How to access 'Bedroom' in this case?