JSFiddle - React, Tailwind, and code Playground

HTML

<p id="union">Using union: </p>

<p id="concat">Using concat: </p>

JavaScript

Array.prototype.union = function(array_to_union) {
    for (i = 0; i < array_to_union.length; i++) {
        this.push(array_to_union[i]);
    }
    return this;
}
                  
var a = [1,2,3];
                  
a.union([4,5,6]).union([7,8,9]);

$('#union').append(a);

// or you could just use the .concat method

var b = [1,2,3];
var c = [4,5,6];


$('#concat').append( b.concat(c) );