JavaScript Array
Array methods for manipulating arrays — map, filter, reduce, find, and more. Arrays are one of the most fundamental data structures in JavaScript. This guide covers all array methods for manipulating, transforming, and iterating over array data. JavaScript arrays are dynamic, resizable, zero-indexed collections that can hold any mix of types including objects, functions, and other arrays. Understanding array methods is essential for writing clean, declarative JavaScript, as modern codebases rely heavily on functional iteration patterns like map, filter, and reduce instead… This category documents 43 JavaScript array entries, and each page gives you the full syntax, the parameter list, the return value, a runnable example, time complexity, and the mistakes developers most often make with that API. Array.prototype.map() — Creates a new array populated with the results of calling a provided function on every element. Array.prototype.filter() — Creates a new array with all elements that pass the test implemented by the provided function. Array.prototype.reduce() — Executes a reducer function on each element, resulting in a single output value. Array.prototype.forEach() — Executes a provided function once for each array element. Array.prototype.find() — Returns the first element that satisfies the testing function. Array.prototype.findIndex() — Returns the index of the first element that satisfies the testing function. Array.prototype.findLast() — Returns the value of the last element that satisfies the testing function. Array.prototype.some() — Tests whether at least one element passes the test. Array.prototype.every() — Tests whether all elements pass the test. Array.prototype.includes() — Determines whether an array includes a certain value. Array.prototype.indexOf() — Returns the first index at which a given element can be found. Array.prototype.push() — Adds one or more elements to the end of an array and returns the new length. Array.prototype.pop() — Removes the last element from an array and returns it. Array.prototype.shift() — Removes the first element from an array and returns it. The entries below are ordered the way the language itself teaches them: creation and growth methods first, then the iteration family, then search, sort, and the immutable copies introduced by ES2023. Each linked page shows the exact signature, what the method returns for edge cases such as empty arrays or sparse slots, its time complexity, and the mistakes developers most often make with it. The entries are: Array.prototype.map(), Array.prototype.filter(), Array.prototype.reduce(), Array.prototype.forEach(), Array.prototype.find(), Array.prototype.findIndex(), Array.prototype.findLast(), Array.prototype.some(), Array.prototype.every(), Array.prototype.includes(), Array.prototype.indexOf(), Array.prototype.push(), Array.prototype.pop(), Array.prototype.shift(), Array.prototype.unshift(), Array.prototype.slice(), Array.prototype.splice(), Array.prototype.concat(), Array.prototype.join(), Array.prototype.sort(), Array.prototype.reverse(), Array.prototype.flat(), Array.prototype.flatMap(), Array.prototype.fill(), Array.prototype.at(), Array.prototype.copyWithin(), Array.prototype.entries(), Array.prototype.keys(), Array.prototype.values(), Array.from(), Array.isArray(), Array.of(), Array.prototype.with(), Array.prototype.toSorted(), Array.prototype.toReversed(), Array.prototype.toSpliced(), Array.prototype.reduceRight(), Array.prototype.lastIndexOf(), Array.prototype.length, Array.prototype.toString(), and more.