I was looking for a way to add new elements to an an existing object like what push does with arrays
I have tried this and it didn't work :
var myFunction = {
Author: 'my name ',
date: '15-12-2012',
doSomething: function(){
alert("helloworld")
}
};
myFunction.push({
bookName:'mybook',
bookdesc: 'new'
});
console.log(myFunction);
See Question&Answers more detail:os