ドキュメント

Utilities/jQuery.merge

From jQuery JavaScript Library

Jump to: navigation, search

« Back to Utilities

jQuery.merge( first, second )

Merge two arrays together.
The result is the altered first argument with the elements from the second array added. The arguments should be true Javascript Array objects; use jQuery.makeArray if they are not. To remove duplicate elements from the resulting array, use $.unique().
Arguments:
firstArray
The first array to merge, the elements of second added.
secondArray
The second array to merge into the first, unaltered.
Examples:

Merges two arrays, altering the first argument.

$.merge( [0,1,2], [2,3,4] )

[0,1,2,2,3,4]

Merges two arrays, altering the first argument.

$.merge( [3,2,1], [4,3,2] )

[3,2,1,4,3,2]

NameType