jQuery.merge() method
Example
Merge two arrays, modifying the contents of the first argument
$
(
function
(
)
{
var
arr
= $.
merge
(
[
0
,
1
,
2
]
,
[
2
,
3
,
4
]
)
; $
(
"
span
"
)
.
text
(
arr
.
join
(
"
,
"
)
)
;
}
)
Try it »
Definition and Usage
The $.merge() function is used to merge the contents of two arrays into the first array.
Syntax
$
.merge( first, second )
| Parameters | Description |
|---|---|
| first | Array type: The first array to merge, which will contain the contents of the second array after merging |
| second | Array type: The second array to merge, which will not be modified |
More examples
Merge two arrays
Merge two arrays and make a copy of the first argument.
jQuery Miscellaneous Methods