Create a copy of t10_arrays.js and name it t10_arrays_ext.js
b) Create a program that uses arrays to hold the chocolate bar data and calculate the most expensive chocolate bar the user can afford with their pocket money.
Hint: One array could hold prices and another array could hold the associated chocolate names...
As in TASK NINE:
Ask the user how much pocket money they have between $1 and $5.
Check that they have entered a valid number within the range 1 to 5.
Calculate the most expensive chocolate bar the user is able to buy, given how much money they have:
Mars bar - $1.50, Moro bar - $1.99, King Size Crunchy - $3.20, Dairy Milk Block - $4.30, Lindt Block - $5.
Display a message informing the user the most expensive chocolate bar they could buy.
What is the advantage of using two arrays over one array in this case?
ITERATIVE DEVELOPMENT:
Documenting the use of:
one array to hold chocolate bar names
multiple arrays, one holding chocolate bar names & the other chocolate bar prices
Then explaining why you used one over the other is a good example of Iterative Development.