For this program, the user will enter numbers which the program will store in an array. Follow these steps:
First, prompt the user for the number of values they plan to enter.
Next, use a loop to prompt the user that number of times, pushing each number into the array
Sort the array in ascending order
Display the sorted array using a second loop
Tips:
For the first loop, you'll need a for or while type loop using the number they entered from the first question in the condition. (This will need to be a for or while loop.)
When sorting, remember to use the arrow function with two parameters, such as "a" and "b", and use "a - b" for the sort.
For the second loop, displaying the sorted array, a for-of loop will work.
Stretch Goal:
Recreate this exercise using string values instead of numerical ones.
For this program, the user will enter numbers which the program will store in an array. Follow these steps:
Tips:
Stretch Goal: