Earlier quoted context omitted.
The way I would describe an array to a novice is that it's a more complex and potentially useful type of variable, similar to the ones you've been making so far, only instead of having a single "slot" for data, they are organized in a way that allows for multiple slots for information, and you can reference each slot by their position in the array, starting with position 0 (0, 1, 2, etc. describing the first, second…
I need some milk! Let me add that to my shopping array. Back in the real world, I see non techies deal with lists every day. Ordered lists. Given a list, with numbers in the margin, they can easily answer "Who came first?" or "What's next on the list?", or "What's item 5 on the agenda". But noooo. We have to call them arrays. Lists are something else. o_O The way I would describe an array to a novice is that it's a m…
For example, I could make an address book array with multiple data points as such:
var addressbook = [{"firstname": "John", "lastname": "Doe", "phone": "555-555-5555", "email": "johndoe@host.com"}, {"firstname": "Jane", "lastname": "Smith", "phone": "666-666-6666", "email": "janesmith@host.com"}]
Then, I can retrieve a piece of information like Jane's phone number like this: var janesnumber = addressbook[1].phone
Arrays are very powerful tools, especially once you start referencing other arrays in them, as it allows complex organization of data without always needing to resort to a database solution, with a whole new language to learn.