Short & Sweet — JavaScript Array Methods (part 1)

Meghan Elizabeth
1 min readJul 23, 2021

--

Photo by M. W on Unsplash

Arrays are used to store multiple values inside a single variable. They are kind of like a list of items. JavaScript has a lot of built in methods to work with arrays. Here are some popular ones.

.toString()

Converts an array to a string

.join()

Joins all elements in an array and turns them into a string (you can use different separators)

.concat()

Joins multiple arrays

.pop()

Remove last element from the end of an array

.push()

Add element to the end of an array

.shift()

Remove the first element from an array

.unshift()

Add new element to the beginning of an array

.sort()

Sorts the elements in an array. Default sorts them by ascending order.

.includes()

Check an array to see if it includes an element

.filter()

Creates a new array with every element in an array that pass the test that we provide it

References

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

No responses yet

Write a response