This project is read-only.

union(second[, comparer, arg])

Produces the set union of two sequences by using a specified equality comparer.

Syntax

Parameters

second
An iteratable object whose distinct elements form the second set for the union.
comparer
Type: function(value1, value2, arg): boolean
The equality comparer to compare values.
arg
An external argument.
Return Value

An iteratable object that contains the elements from both input sequences, excluding duplicates.

Examples

var ints1 = [ 5, 3, 9, 7, 5, 9, 3, 7 ];
var ints2 = [ 8, 3, 6, 4, 4, 9, 1, 0 ];

var union = $from(ints1).union(ints2);

union.each("document.writeln($)");

/*
 This code produces the following output:

 5 3 9 7 8 6 4 1 0
*/

Last edited May 18, 2012 at 11:49 AM by suckgamoni, version 1

Comments

No comments yet.