I am trying to solve Array question on leetcode Array Merge Sort and issue is that when I am running my code in online compiler i.e. JS Fiddle, Programiz, I can see the complete array after concatenation but when I am running same code on leetcode compiler getting only first array instead of complete array.
Can someone please advise where, I am facing the issue.
PFA of issue -
Leetcode Submission Report --> Here, I'm getting half array instead of complete array.
Online Compiler Output --> Here, I'm getting the complete array.
Below is my code for Leetcode Question -
var merge = function(nums1, m, nums2, n) {
let x = nums1.length;
if(x !== m){
for(let i = x; i > m; i--){
nums1.pop(nums1[i]);
}
}
return nums1.concat(nums2).sort((a,b)=> a -b);
};
console.log(merge([1,2,3,0,0,0],3,[2,5,6],3));