Примеры для jQuery.merge()


Merges two arrays, altering the first argument.

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

Result:

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

Merges two arrays, altering the first argument.

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

Result:

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

Merges two arrays, but uses a copy, so the original isn't altered.

1
2
3
var first = [ "a", "b", "c" ];
var second = [ "d", "e", "f" ];
$.merge( $.merge( [], first ), second );

Result:

1
[ "a", "b", "c", "d", "e", "f" ]