const mergeArrays = (arrA, arrB) => arrA.concat(arrB).sort((a,b) => a - b)
function mergeArrays(arrA, arrB) {const output = [];const arrAClone = [...arrA];const arrBClone = [...arrB];let nextSmallestA = arrAClone.shift();let nextSmallestB = arrBClone.shift();while (nextSmallestA !== undefined || nextSmallestB !== undefined) {if (nextSmallestA === undefined || nextSmallestB < nextSmallestA) {output.push(nextSmallestB);nextSmallestB = arrBClone.shift();} else {output.push(nextSmallestA);nextSmallestA = arrAClone.shift();}}return output;}- const mergeArrays = (arrA, arrB) => arrA.concat(arrB).sort((a,b) => a - b)