merge Posted on 2019-09-28 Edited on 2019-10-16 In JavaScript 123456789101112/** * @param {number[]} nums1 * @param {number} m * @param {number[]} nums2 * @param {number} n * @return {void} Do not return anything, modify nums1 in-place instead. */var merge = function(nums1: number[], m: number, nums2: number[], n: number) { let s1 = nums1.slice(0, m); let s2 = nums2.slice(0, n); [...s1, ...s2].sort((a, b)=>a-b).map((v, k) => nums1[k] = v);};