Javascript examples for Object:Object Keys
Get the current size of the object
<html> <head> <meta name="viewport" content="width=device-width"> </head> <body> <script> var alerts = {/*from ww w. jav 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>