Tiffany is writing a program to help manage a bake sale. She writes the following code which prompts the user to enter the total number of items a person is buying and then a loop repeatedly prompts for the cost of each item. She wrote the code but there is a problem: it runs in an infinite loop. How can Tiffany change her code so it doesn't loop forever? 0 var numItems = promptNum("How many items?"); 1 var total = 0;

Respuesta :

Answer:

Add after line 3:

numItems = numItems - 1;

Explanation:

The complete code of Tiffany should be provided in question is:

line 0 -- var numItems = promptNum("How many items?");

line 1-- var total = 0;

line 2-- while (numItems > 0){

line 3-- total = total + promptNum("Enter next item price");

line4-- }

line 5-- console.log("The total is" + total);

ACCESS MORE