Javascript – What is the difference between both the sample?
Sample 1: function mergesort(arr){ if (arr.length > 1){ let mid = parseInt(arr.length/2); let left = arr.slice(0,mid); let right = arr.slice(mid); mergesort(left); mergesort(right); return merge(left,right); } else return arr; } Sample 2: function mergesort(arr){ if (arr.length > 1){ let mid =…