合并 2 个对象数组
2022-08-30 01:51:38
让我们看一个示例。
var arr1 = new Array({name: "lang", value: "English"},
{name: "age", value: "18"});
var arr2 = new Array({name : "childs", value: '5'},
{name: "lang", value: "German"});
我需要合并这两个对象数组并创建以下数组:
var arr3 = new Array({name: "lang", value: "German"},
{name: "age", value: "18"},
{name : "childs", value: '5'});
是否有任何JavaScript或jQuery函数可以做到这一点?
$.extend
不适合我。它返回
var arr4 = new Array({name : "childs", value: '5'},
{name: "lang", value: "German"});