问题:
I have an object that holds alerts and some information about them:我有一个包含警报和有关它们的信息的对象:
var alerts = {
1: { app: 'helloworld', message: 'message' },
2: { app: 'helloagain', message: 'another message' }
}
In addition to this, I have a variable that says how many alerts there are, alertNo
.除此之外,我还有一个变量来说明有多少警报, alertNo
。 My question is, when I go to add a new alert, is there a way to append the alert onto the alerts
object?我的问题是,当我添加新警报时,有没有办法将警报附加到alerts
对象上?
解决方案:
参考一: https://en.stackoom.com/question/2aWC参考二: https://stackoom.com/question/2aWC