MergeSort implementation in Javascript