Add new element to an existing object

后端 未结 6 1808
走了就别回头了
走了就别回头了 2020-12-13 12:41

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 myF         


        
6条回答
  •  春和景丽
    2020-12-13 13:28

    jQuery syntax mentioned above by Danilo Valente is not working. It should be as following-

    $.extend(myFunction,{
        bookName:'mybook',
        bookdesc: 'new'
    });
    

提交回复
热议问题