In JavaScript, I've created an object like so:
(在JavaScript中,我创建了一个像这样的对象:)
var data = {
'PropertyA': 1,
'PropertyB': 2,
'PropertyC': 3
};
Is it possible to add further properties to this object after it's initial creation if the properties name is not determined until run time?
(如果直到运行时才确定属性名称,是否可以在初始创建此对象后为其添加其他属性?)
ie (即)
var propName = 'Property' + someUserInput
//imagine someUserInput was 'Z', how can I now add a 'PropertyZ' property to
//my object?
ask by Lee D translate from so 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…