DEV Community

Cover image for Some Arrays Javascript Methods You Might Want to Know 🚀
Renan Ferro
Renan Ferro

Posted on

2

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!

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay