Here's my functtion
var getLocaleDefault = function(settings){
var defaultLocale = settings.defaultLocale;
eval('var locale = settings.locale.'+defaultLocale);
return locale;
}
settings is a JSON.parse()ed object of a JSON
{
"classes": 8,
"config": "classConfig",
"locale": {
"en": "localeEn"
},
"defaultLocale": "en"
}
As the code is: I am trying to get object.locale.en just because defaultLocale is en. Is there a better way other than eval to achieve what i am trying to do? Or is it the best/effective way of doing these kind of works?