Tell us what’s happening:
Hi guys,
I have to extract the right part of an array, I can see in the console.log, that the code does it right, but my code doesn’t pass. Also it doesn’t pass if I remove return and console.log statements. Must be something silly I am missing?
Your code so far
function mergeSort(array) {
const middlePoint = Math.floor(array.length / 2);
const leftPart = array.slice(0, middlePoint);
// User Editable Region
const rightPart = array.slice(middlePoint, array.length)
return [leftPart, rightPart]
// User Editable Region
}
console.log(mergeSort([1, 2, 3, 4, 5, 6]))
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36 Edg/146.0.0.0
Challenge Information:
Implement the Merge Sort Algorithm - Step 4