JSFiddle - React, Tailwind, and code Playground

by CommandLineDesign

JavaScript

var sortAscending = function(a, b){
	return a - b;
}

var removeDupes = function(elem, index, self){
	return index == self.indexOf(elem);
}

var merge = function (arrayA, arrayB){
	return arrayA.concat(arrayB).sort(sortAscending).filter(removeDupes);
}

console.log(merge([2, 3, 5, 7, 11], [2, 4, 6, 8, 10, 12, 14]))