2
var sql = {
datatypes: {
integer:
{
INT: {
mysql: 'INT'
},
SMALLINT: {
mysql: 'SMALLINT'
}
}
}
}
// Funciona
alert(sql.datatypes.integer.SMALLINT.mysql);
// Não funciona
teste("SMALLINT");
function teste(type){
alert(sql.datatypes.integer.type.mysql);
}
Duplicate of http://answall.com/a/101938/129 (how to access properties of a JSON/Object dynamically)
– Sergio
Has any response helped solve the problem and can address similar questions from other users? If so, make sure to mark the answer as accepted. To do this just click on the left side of it (below the indicator of up and down votes).
– Sorack