JavaScript – Using a variable to refer to a property name? [duplicate]

If you want to use a variable property name, use subscript syntax:

var fieldname="test";

//These two lines are equivalent as long as fieldname is 'test':
gridObject[fieldname] = fieldvalue;
gridObject.test = fieldvalue

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)