function mergeSort(arr) {
    if (arr.length <= 1) return arr;
    let mid = Math.floor(arr.length / 2);
    let left = arr.slice(0, mid);
    let right = arr.slice(mid);
    return merge(mergeSort(left), mergeSort(right));
}

function merge(left, right) {
    let result = [];
    let leftIndex = 0;
    let rightIndex = 0;
    while (leftIndex < left.length && rightIndex < right.length) {
        if (left[leftIndex] < right[rightIndex]) {
            result.push(left[leftIndex]);
            leftIndex++;
        } else {
            result.push(right[rightIndex]);
            rightIndex++;
        }
    }
    return result.concat(left.slice(leftIndex)).concat(right.slice(rightIndex));
}

This implementation of the MergeSort algorithm first checks if the input array has a length of one or less. If it does, the function returns the input array. If not, the function uses the slice() method to split the input array into two parts: the left half, and the right half. It then recursively calls itself on each half, and passes the result to the merge() function.

The merge() function takes two sorted arrays as input, and returns a new sorted array by repeatedly comparing the first element of each input array, and adding the smaller element to the result. If one input array is exhausted, the remaining elements of the other input array are added to the result.

Here's an example of how the function can be used:

let arr = [5, 3, 8, 4, 1, 9, -3];
console.log(mergeSort(arr));  // [-3, 1, 3, 4, 5, 8, 9]