Given two sorted arrays nums1 and nums2 of size m and n respectively, return the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)).
/**
* @param {number[]} nums1
* @param {number[]} nums2
* @return {number}
*/
// Linear mergesortish approach
// O(N + M) time, O(1) space
varfindMedianSortedArrays=function(nums1, nums2){
let median1 =0;
let median2 =0;
let index1 =0;
let index2 =0;
let i =0;
// For the combined array, we go up to the halfway point