- ✕This summary was generated using AI based on multiple online sources. To view the original source information, use the "Learn more" links.
JavaScript provides a variety of built-in methods to manipulate and traverse arrays efficiently. These methods enhance code readability and productivity by offering functionalities like adding, removing, and transforming elements, as well as searching, sorting, and iterating through array elements.
Common Array Methods
1. push()
Adds one or more elements to the end of an array and returns the new length of the array.
let fruits = ["Apple", "Banana"];fruits.push("Orange");console.log(fruits); // ["Apple", "Banana", "Orange"]Copied!✕Copy2. pop()
Removes the last element from an array and returns that element.
let fruits = ["Apple", "Banana", "Orange"];let removed = fruits.pop();console.log(fruits); // ["Apple", "Banana"]console.log(removed); // "Orange"Copied!✕Copy3. shift()
Removes the first element from an array and returns that element.
let fruits = ["Apple", "Banana"];let removed = fruits.shift();console.log(fruits); // ["Banana"]console.log(removed); // "Apple"Copied!✕Copy4. unshift()
JavaScript Array Methods - W3Schools
Array - JavaScript | MDN
Feb 24, 2026 · Several of the built-in array methods (e.g., join(), slice(), indexOf(), etc.) take into account the value of an array's length property when they're called. Other methods (e.g., push(), splice(), etc.) …
- Watch full videoWatch full video
JavaScript Array Methods
Learn how to use various methods to manipulate arrays in JavaScript, such as adding, removing, finding, sorting, and transforming elements. See the syntax, parameters, and examples of each method in this …
JavaScript Array Methods - GeeksforGeeks
Aug 5, 2025 · To help you perform common tasks efficiently, JavaScript provides a wide variety of array methods. These methods allow you to add, remove, find, …
Array methods - The Modern JavaScript Tutorial
Dec 31, 2023 · Afterwards whenever you need to do something with an array, and you don’t know how – come here, look at the cheat sheet and find the right …
Javascript Array Methods
Learn how to use built-in functions to perform operations on arrays in JavaScript. See examples of push, pop, shift, unshift, concat, slice, splice, join, and reverse methods.
JavaScript Array Methods Cheat Sheet - DevSheets
Methods to add and remove array elements. Extract portions and combine arrays without mutation. Sort and reverse array elements in place. // Sort (mutates array!) arr.sort((a, b) => b - a); // Numeric …
20 Essential JavaScript Array Methods Every Developer …
May 13, 2023 · In this comprehensive guide, we'll explore 20 essential JavaScript array methods with practical examples, performance insights, and real-world use …
JavaScript Arrays - W3Schools
Arrays are a special type of objects. The typeof operator in JavaScript returns "object" for arrays. But, JavaScript arrays are best described as arrays. Arrays use numbers to access its "elements". In this …
JavaScript Array Methods with Practical Examples
Jul 5, 2024 · In JavaScript, an array is a data structure that stores multiple values in a single variable. The power of JavaScript arrays comes from their built-in …