Working with Arrays

Working with Arrays

This week we had the opportunity to learn about arrays, including how to create them, reference them, send them as an argument to a function, and manipulate them using JavaScript’s built in array methods. This was a lot of fun, and just like other skills we’ve learned up to now I see a lot of potential uses for arrays, and I’m sure there are more uses that I’m not even aware of yet. I’m excited that my basic knowledge of programming is expanding, and I’m enjoying it so much, but I’m finding it hard to be patient: I want to know and understand and be able to competently create programs that are truly useful.

Our programming assignment this week was to create a program that reads an array, then totals the first and last values and finds the middle value or the average of the two middle values. Brother Blazzard had shown his own project during the lab discussion which utilized a random array generator, and I wanted to do the same thing. So I created a function in my program to randomly create an array that was from 5 to 15 values long and populate it with random values from 0 to 10. Then the program read that array to create the other needed values.

I had the chance to work with Brady, a student tutor, on my program. He was helpful in figuring out how to create the random array generator. I’ve had a hard time wrapping my head around how to work with random numbers, but I learned a lot working with him and I think I have a much better handle on it now. I think the effort paid off, because two other students, Andrea and Ian, complimented my program and told me that it helped them with their own array generators.

I noticed that some students hard coded arrays into their programs. I thought that was a simple and effective idea for testing purposes, and I initially did the same thing to test my other functions when I created them. I thought the random array generator was a good addition because it allows the other functions to be demonstrated as much as needed against many different possibilities.

Array Program

Leave a Reply

Your email address will not be published. Required fields are marked *