Question: Modify the script of Exercise 4.6 to get a second input from the user, which is either ascending or descending. Use this input to determine

Modify the script of Exercise 4.6 to get a second input from the user, which is either "ascending" or "descending". Use this input to determine how to sort the input words.


Data from exercise 4.6

Input: A line of text, using prompt.
Output: The words of the input text, in alphabetical order.


Write, test, and debug (if necessary) JavaScript scripts for the problem that above. When required to write a function, you must include a script to test the function with at least two different data sets. In all cases, for testing, you must write an HTML file that references the JavaScript file.

Step by Step Solution

3.38 Rating (160 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming World Wide Questions!