jQuery.merge()Method

jQuery 杂项方法jQuery Miscellaneous Methods

Examples

Merge two arrays, modifying the contents of the first parameter

$(function () { var arr = $.merge( [0,1,2], [2,3,4] ); $("span").text(arr.join(", ")); })

Try it yourself »

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 used for merging; after merging, it will contain the contents of the second array.
second Array type. The second array used for merging; this array will not be modified.


实例

More Examples

Merge two arrays
Merge two arrays, and make a copy of the first parameter.

jQuery 杂项方法jQuery Miscellaneous Methods

Other Extensions