I wonder how it is possible in a similar situation, the solution
var lang_object = {
"UK": {
"ERROR": {
"fullname_empty": "fullname error",
"phone_empty": "phone error",
}
}
};
I have JSON Object.
var z = 'UK';
console.log(lang_object.z.ERROR.fullname_empty);
this example do not work, why? z = "UK".
var z = eval('UK');
console.log(lang_object.z.ERROR.fullname_empty);
this also dont work.
console.log(lang_object.UK.ERROR.fullname_empty);
this example work