I'm a javascript beginner and I'm trying to merge two arrays.
I have two arrays like this:
arr1[
{
description : "this is a object",
array : ["a","b"]
}
]
arr2[
{
array : ["c","d"]
}
]
And I want to get a resulting javascript object like this
result = { description : "this is a object", array : ["a","b","c","d"]}
The order of elements isn't important to me. So I tried the following.
result = $.extend(true, {},arr1,arr2)[0];
But this returns the following output
result = { description : "this is a object", array : ["c","d"] }
Which isn't what I want the result to be since it's missing values. How can I merge them the way I want?