Line chart x-axis not sorted

i made a quick sort function for someone else over here if ya'll need it.

const quickSort = (myArray) => {
  if (myArray.length <= 1) {
    return arr;
  }

  // this can be any of the array items, I picked the middle as it's simple.  
  // generally you want to avoid using the first or last index as the pivot as it increases the odds of hitting a worse-case scenario of O(n^2).  the majority of the time you'll get around O(n log(n))
  let mid = myArray.length / 2;
  let pivot = myArray[mid];

  let leftArray = [];
  let rightArray = [];

  for (let i = 1; i < myArray.length; i++) {
    // sort numeric values
    else{
      if (myArray[i] < pivot) {
        leftArray .push(myArray[i]);
      } else {
        rightArray .push(myArray[i]);
      }
    }
  }

  return [...quickSort(leftArray ), pivot, ...quickSort(rightArray )];
};

removed custom 'string' stuff the person needed so now it's back to a normal quick sort

2 Likes