Now you need to actually sort the array. The first sorting algorithm you will implement is the bubble sort, which starts at the beginning of the array and 'bubbles up' unsorted values towards the end, iterating through the array until it is completely sorted. const bubbleSort = (array) => { for (let i = 0; i < array.length; i++) { for (let j = 0; j < array.length - 1; j++) { console.log(array, array[j], array[j + 1]); if (array[j] > array[j + 1]) { const temp = array[j]; array[j] = array[j + 1]; array[j + 1] = temp; } } } return array; } Time to implement another sorting algorithm. This time, you'll be implementing a selection sort. Selection sort works by finding the smallest value in the array, then swapping it with the first value in the array. Then, it finds the next smallest value in the array, and swaps it with the second value in the array. It continues iterating through the array until it is completely sorted. const selectionSort = (array) => { for (let i = 0; i < array.length; i++) { let minIndex = i; for (let j = i + 1; j < array.length; j++) { console.log(array, array[j], array[minIndex]); if (array[j] < array[minIndex]) { minIndex = j; } } const temp = array[i]; array[i] = array[minIndex]; array[minIndex] = temp; } return array; } The last sorting algorithm you will implement is the insertion sort. This algorithm works by building up a sorted array at the beginning of the list. It begins the sorted array with the first element. Then it inspects the next element and swaps it backward into the sorted array until it is in a sorted position, and so on. const insertionSort = (array) => { for (let i = 1; i < array.length; i++) { const currValue = array[i]; let j = i - 1; while (j >= 0 && array[j] > currValue) { array[j + 1] = array[j]; j--; } array[j + 1] = currValue; } return array; } To sort the elements of an array, you can use the built-in method called .sort(). Notice how the double digit number(10) is placed at the beginning of the array. This is because the default behavior of .sort() is to convert the numbers values to strings, and sort them alphabetically. And 10 comes before 2 alphabetically. To fix this, you can pass a callback function to the .sort() method. The callback function has two parameters - for yours, use a and b. The parameters of a and b represent the number values in the array that will be sorted. const sortedValues = inputValues.sort((a, b) => { return a - b; });