Given 2 arrays sorted in ascending order, explain and implement an optimal algorithm to merge the arrays in descending order. Example: A = [1, 2, 3] B = [4, 5, 6] and Output = [6, 5, 4, 3, 2, 1]
Example: Write a function that takes in two sorted arrays and returns a new array with all elements sorted not using array method sort.
// const newSortArrays = (arr1, arr2) => {
// let output = [];
// while (arr1.length && arr2.length) {
// if (arr1[0] < arr2[0])
// output.push(arr1[0] < arr2[0] ? arr1.shift() : arr2.shift())
// }
// return [...output, ...arr1, ...arr2]
// }