Javascript examples for Object:Object Literal
Add an object after the last one in an object literal
<html> <head> <meta name="viewport" content="width=device-width"> </head> <body> <script> var alerts = {//from www . j av a 2 s . c om 1: {app:'a',message:'message'}, 2: {app:'b',message:'another message'} } var size = Object.keys(alerts).length alerts[size + 1] = {app:'Another hello', message:'Another message'} console.log(alerts) </script> </body> </html>