Javascript examples for Object:Object Operation
Appending to an object
<html> <head> <meta name="viewport" content="width=device-width"> </head> <body> <script> var alerts = {/*from w ww . j a v a 2 s. c o m*/ 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>