I want output as [1,2,2,3,5,6] but its giving [0,1,2,2,3,5,6]. I do not know why this 0 is coming initially.
var merge = function(nums1, nums2, ) {
var nums3 = nums1.concat(nums2);
nums3.sort((a, b) => a - b)
nums3.filter((currentValue, currentIndex) => {
if (currentValue === 0)
nums3.splice(currentIndex, 1)
})
nums1 = nums3
return nums1
};
console.log(merge([1, 2, 3, 0, 0, 0], [2, 5, 6]))