DEV Community

Cover image for Some Arrays Javascript Methods You Might Want to Know πŸš€
Renan Ferro
Renan Ferro

Posted on

Some Arrays Javascript Methods You Might Want to Know πŸš€

Hello everyone, today I want to talk a little about Array in Javascript and show some examples about it!

What is Javascript Arrays!?

In a nutshell, Arrays in Javascript are a hight level global object to make a something like a "list". Now, let's see some examples of methods with we can do with Array!

Array.prototype.length()

Get the length of items in your array.
Image description


Array.prototype.find()

Returns the value of the first element that matches with its validation.
Image description


Array.prototype.forEach()

Loops through each of the elements in your array.
Image description


Array.prototype.includes()

Checks if Array contains certain element and returns true or false, respectively.
Image description


Array.prototype.map()

Creates a new array with the values ​​according to the function that was passed.
Image description


Array.prototype.sort()

Returns an Array of sorted values, sorted in ascending order.
Image description


Array.prototype.entries()

Returns a new Array object that has a key and value for each element of the source array.
Image description


Array.prototype.push()

Add one or more new elements to the Array.
Image description


There are many others Array methods, I wanted to bring some examples and I hope you liked it!

Have you seen or used them all on the list!? Leave a comment, it will be nice to hear about your experience with them!

See you soon folks!

Top comments (0)