Common JavaScript Array Methods
1. pop()
pop() removes the last element from an array and returns that element. This method changes the original array.
let arr = [1, 2, 3, [4, 5, 6]];
console.log(arr.pop()); // [4, 5, 6]
console.log(arr); // [1, 2, 3]
2. push()
push() adds one or more elements to the end of an array and returns the new length of the array. It modifies the or ...
Posted on Tue, 15 Sep 2026 16:19:01 +0000 by JessePHP
JavaScript Arrays: A Comprehensive Guide with Lodash Examples
Arrays in JavaScript are high-performacne, list-like objects. They use numeric indices starting from 0. This guide covers core array operations and common Lodash utilities for more advanced tasks.
Basic Array Characteristics and Operations
Array length: arr.length
Modifying length:
If you set a larger length, the extra slots become empty (not ...
Posted on Tue, 18 Aug 2026 16:27:57 +0000 by JJBlaha
Essential JavaScript Array Methods You Should Know
Adding and Removing Elements
push() - Append Elements to the End
const data = [1, 2, 3];
data.push(4);
console.log(data); // [1, 2, 3, 4]
pop() - Remove the Last Element
const items = ['a', 'b', 'c'];
const removed = items.pop();
console.log(removed); // 'c'
console.log(items); // ['a', 'b']
shift() - Remove the First Element
const numbers ...
Posted on Sun, 09 Aug 2026 16:24:22 +0000 by freaka
6 ES6 Tips for More Efficient JavaScript Coding
Array.of: Consistent Array Creation
The Array constructor in JavaScript can behave unexpectedly based on the number of arguments passed:
// Inconsistent behavior of Array constructor
const arr1 = Array(3); // [ , , ]
const arr2 = Array(); // []
const arr3 = Array(undefined); // [undefined]
const arr4 = Array(1, 2, 3); // [1, 2, 3]
This inconsi ...
Posted on Thu, 30 Jul 2026 16:53:40 +0000 by scottfossum
Essential JavaScript Array Methods Every Developer Should Know
Arrays are special variables used in programming languages to store multiple elements. JavaScript arrays come with built-in methods that every developer should understand and utilize appropriately. These methods allow us to add, remove, iterate, or manipulate data as needed. In this article, we'll explore five fundamental JavaScript array metho ...
Posted on Sat, 20 Jun 2026 16:54:27 +0000 by gtanzer