How about storing the alerts as records in an array instead of properties of a single object ?
var alerts = [
{num : 1, app:'helloworld',message:'message'},
{num : 2, app:'helloagain',message:'another message'}
]
And then to add one, just use push
:
alerts.push({num : 3, app:'helloagain_again',message:'yet another message'});
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…