DEV Community

10 Array Methods You Should Know 👀

Rebecca Womack on January 28, 2020

The Basics 🕺 So what are arrays? 🤔 ar·ray /əˈrā/ noun 1. an ordered series or arrangement. In computer science, an array data structure, or s...
Collapse
 
madza profile image
Madza

always have to open docs for slice and splice :)

Collapse
 
karataev profile image
Eugene Karataev

For me slice is nice and handy method to take a part of an array without mutating the original.
splice on the other hand is like a monster, because it mutates the original array.
splice

Collapse
 
nick profile image
Nick

Haha, soo true.

Collapse
 
joshmedeski profile image
Josh Medeski

I'm so thankful for .map now. We used to have to do for loops manually and push to a new array!

Collapse
 
aritdeveloper profile image
Arit Developer

excellent post! thanks for sharing!

Collapse
 
saravanaworkspaces profile image
Saravana kumar Chinnaraj • Edited

Hey Nice article, But can you check shift() and unshift() once again ASAP.

And map example too "numberOfWins".

Collapse
 
rebeccauranga profile image
Rebecca Womack

Thanks so much for pointing those out! I appreciate your feedback.

Collapse
 
michaelwomack profile image
Michael Womack

Great post! I would love to read a part 2.

Collapse
 
tobiasramzy profile image
Tobias

Thank you 🥺

Collapse
 
abdulghani200 profile image
Abdul Ghani

Nice and informative. Thanks for sharing ♥️

Collapse
 
arilength profile image
ari.length

Simple and efficace post thanks !! :)

Collapse
 
abraham profile image
Abraham Williams

A complementary resource is doesitmutate.xyz/. It'll tell you if an array method mutates the value or copies it.

Collapse
 
hadmouse profile image
Fabián Vera

"(Reduce) method takes two parameters, the accumulator and the current value" That's pretty reductive (no pun intended), since it takes four.