performs set  union of arrays;
get first n elemnts of array
add indexOf function to get the first index of an element
add unique function to get unique elemets of array
add rest function to get rest of the elements elements of array from the specified index