
Originally Posted by
jamesy23
I understand, but it's not an assignment. Its more of something my former teacher has challenged me too!
I suppose the main thing I wanted to know was how I can build an array that will let me enter any number of books. For example I could enter 2 or 15.. I have no idea how to set that up.
Typically you would place the books array somewhere that it can be easily accessed. What used to be done is to make it a global array, but that's not a good practice these days after we learn that globals should be kept to an absolute minimum, so a good place to store the array is as a property on the form that you use to to enter the information.
HTML Code:
<form id="bookSale">
...
</form>
Code javascript:
var form = document.getElementById('bookSale');
form.books = [];
Bookmarks