Currently, my goal is to create an Array.prototype
function called union( array_to_union )
, and then utilize it in the following manner:
var a = [1,2,3];
a.union([2,3,4]).union([1,3,4]) ......
I am aiming for the outcome to be the union of these arrays. How can I achieve this?
My understanding is that I need to employ
Array.prototype.union = function( array_to_union){.....}
.