union()

Creates a new array which will contain all of the items of the two given arrays. Different from concatenation because the number of times a value occurs will never exceed the maximum number of times it was found in one of the arrays.

This function is valid in v2.1.0 to v2.24.3. This function has been downloaded 60 times.

Parameters

{Array} array1
First array to union with the second array.
{Array} array2
Second array to union with the first array.

Returns

{Array}
An array of all of the items from array1 and array2 but limiting the occurrences to never exceeding the maximum number of times the value occurred in either array.

Required Function

This function directly requires the following function which is included automatically:

  • diffArrays()
    Creates a new array which is the difference of the two given arrays.