DEV Community

Ty
Ty

Posted on

JavaScript Arrays

Every language has their own array. But Java has a special place in my heart. While it is similar to Ruby in my experience. There are different methods that would help with you learning JavaScript.

Like any other arrays, the index of an array will always start at 0, and increment by 1.

First you have your common methods such as push(), pop(), shift(), reverse()

Push -> This method will allow you to add an element to the end of the array

Shift -> This method removes the first element of the array

Pop -> This method removes the last element of the array

reverse -> This method will change the whole array order in reverse.

However there are some methods that can help you iterate through a whole array.

We have methods such as forEach(), and map()

forEach -> Executes a function that is used for every element in the array

map -> Returns a new array that is filled by the function that is being called on each element of the array

Knowing these arrays method would help you get through the basics of JavaScript and it is what I used the most on the daily.

Top comments (0)