Arrays are used to store data, process data and to lookup data. Arrays can be loaded in your javascript and can be dynamically updated with your javascript as your page is processed. Make all changes to this page.
1. Create a array called productNames. It will have the following values: shoes, socks, sandals, shorts, shirts
2. Create a parallel array called productSales. It will have the following values: 170.50, 110.25, 3130.75, 125.50, 80;
3.
Total Sales are: put results here!
The button will call a function
The function will use a loop to add the productSales together
Display Total Sales results in the area indicated above.
The display should be formatted as a dollar amount.
4. Display Product sales form.
Product:
Product Sales:
The button will take the requested product and display the corresponding Sales amount in the Product Sales field.
The Sales amount should be formatted as currency.
If an invalid product is entered display a 'Product Not Found' message next to the Product field.
Rubric: Points for 1. and 2.
0 Not attempted.
3 Attempted but not correct.
5 Correctly written.
Rubric: Points for 3. and 4.
0 Not attemped.
2 Displays something.
3 Displays correct values, but not formatted.
4 Displays correct values, properly formatted.
5 Works as expected with additional coding or effects.
Extra Credit:
Allow the user to type in the desired information instead of hardcoding them in the script. This could either the products or the sales amounts or both.
1 Use the prompt to gather this information.
2 Allow for any number or type of products and/or sales amount.