Bubble Sorted Bar Chart

Bubble sorted =

Bubble sort code:

const bubbleSort = nums => {
  let swap = true;

  do {
    swap = false;
    for (let i = 0; i < nums.length; i++) {
      if (nums[i] < nums[i + 1]) {
        const tmp = nums[i];
        nums[i] = nums[i + 1];
        nums[i + 1] = tmp;
        swap = true;
      }
    }
  } while (swap);  

  return nums;
};