jquery merge two objects

后端 未结 5 2173
迷失自我
迷失自我 2021-02-07 04:52

How can I merge jquery objects together

I have

 {
  \"merchantcontract\":\"Ready Reserve Foods 10104.01\",
  \"merchantcontractid\":\"c4253769-5a57-e11         


        
5条回答
  •  醉梦人生
    2021-02-07 05:51

    anObj={'propone':'1', 'proptwo':'2'};
    anotherObj={'propel':'11', 'proptlv':'12'};
    var opts = {};
    $.extend(opts, anObj, anotherObj, { 
        bar: "baz",
        thing: "foo"
    });
    console.log(opts);
    

    Example

提交回复
热议问题