DEV Community

Vamshi Krishna
Vamshi Krishna

Posted on

1

Array methods in JavaScript, some of the most commonly used ones include:

.push(): adds one or more elements to the end of an array and returns the new length of the array.
.pop(): removes the last element of an array and returns that element.
.shift(): removes the first element of an array and returns that element.
.unshift(): adds one or more elements to the beginning of an array and returns the new length of the array.
.slice(): returns a shallow copy of a portion of an array into a new array object selected from begin to end (end not included) where begin and end represent the index of items in that array.
.splice(): changes the contents of an array by removing or replacing existing elements and/or adding new elements in place.
.sort(): sorts the elements of an array in place and returns the array.
.reverse(): reverses the order of the elements in an array in place and returns the array.
.concat(): returns a new array that is the result of concatenating the given arrays or values.
.forEach(): executes a provided function once for each array element.
Many other functions are available in JS like Map, Filter, Reduce, etc.

Heroku

Simplify your DevOps and maximize your time.

Since 2007, Heroku has been the go-to platform for developers as it monitors uptime, performance, and infrastructure concerns, allowing you to focus on writing code.

Learn More

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

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

Okay