Array Methods

James
2 min readMar 19, 2018

--

This blog post marks the beginning of week three enrolled in my “coding boot camp” through The Suncoast Developers Guild. I came in with some basic knowledge of computer programming and web development. My knowledge base was disorganized, scattered around in a few different languages. Trying to make the pieces come together was difficult while also balancing a full time job. Two weeks in and the pace has been quick, i’ve learned so much already. Today we’ve been assigned the task of documenting one of those things we’ve learned in a blog post. So, here I am.

Array methods — i’ve decided to choose a more recent topic in order to help solidify my understanding of them. Since starting this blog post five minutes ago, I can already see that this can be a useful tool to help gather your thoughts about new topics. Before discussing array methods, it would be useful to understand what an array is first. An array is an object that is used to store multiple values in a single variable. For example: cars = [“Volvo”, “Toyota”, “Subaru”, “Honda”, “Tesla”]. Also useful, is a loose definition of a method. Methods are actions that can be performed on objects.

We were able to discuss a few array methods in class today. Some of them were:

Find () : The find() method takes a function and returns the first element in an array that passes the test provided by the function.

Map (): The map() method creates a new array with the results from a given function on every element in the array.

Pop (): The pop() method will remove the last element of an array and return that array (this will shorten the length of the array).

Push (): The push() method adds items onto the end of an array, changing (increasing) the length.

Reduce (): The reduce method applies a function against an accumulator and each element from left to right, reducing it to a single line.

There were other array methods discussed, and plenty more we haven’t discussed directly. That just means more to research, or more to utilize in the future as my skills progress and I am exposed to different circumstances.

--

--