JavaScript - Prompt Loop and Storing Input The next element of the program is to continue to prompt the user for input, storing each input into an array, until the user does not enter anything into the prompt dialog. First, you'll need an empty array.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Part 4: JavaScript - Prompt Loop and Storing Input

The next element of the program is to continue to prompt the user for input, storing each input into an array, until the user does not enter anything into the prompt dialog. First, you'll need an empty array.

>> Add an empty array to the startup function. Name the array data. Declare the array as a constant array.

Tip: Making our array a constant array prevents us from accidentally overwriting the entire array contents, but does not prevent us from adding data to the array.

With the input storage ready, we can know work on our prompt loop. You will need to figure out how to continuously prompt the user for input using the prompt function, and either a while loop, or a do...while loop - either loop structure will work. You can ignore storing the input for now, and just focus on the prompt loop.

>> Add code to the startup function to continuously prompt the user for input using either while or do...while, and the prompt function, until the user leaves the prompt input dialog empty. 

Tip: You will need to use String functionality to test if the input is empty or not.

Once you have the prompt loop complete, you can modify the loop to capture the input by adding each input into the data array.

>> Add code to the prompt loop that adds the input into the array. You will need to use an array function that adds array elements to the end of the array. After each input is added to the array, the array will be one element in length larger.

Tip: The assignment will require all input to be converted to upper case letters, and to be displayed in a random color. You may be tempted to modify the input data as the data is added to the array, but leave the data as entered by the user.

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Array
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-engineering and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY