I am trying to create a key-value pair javascript object as follows:
var p={'revEv':[{'EventsId':rand,
if(Ext.getCmp('Val_'+id).getValue()!='E')
'Status':Ext.getCmp('Val_'+id).getValue(),
'core':Ext.fly('coreVal_'+id).dom.innerHTML,
'transactionType':{'transactionTypeId':Ext.fly('oppVal_'+id).dom.innerHTML,'description':Ext.fly("oppDesc_"+id).dom.innerHTML},
'timing':Ext.getCmp('quarter_'+id).getValue()},]}
As seen above, for a particular entry 'Status' - I need to create/insert the key only if a particular condition is satisfied.
What is an elegant way to do this in javascript?
ifstatement in object literals.