Quick Guide to JavaScript Array Methods
JavaScript arrays include a broad set of methods that handle data transformation, iteration, searching, filtering, flattening, and more. Understanding these methods allows you to write cleaner, more expressive code and avoid manual loops that are harder to maintain. This guide revisits the most commonly used array methods, explains their purpose, and provides updated examples for real‑world usage. It also includes three static methods available on the Array constructor.

1. concat()
Merges two or more arrays into a new array.
const fruits = ["apple", "banana"];
const nums = [1, 2];
const merged = fruits.concat(nums);2. every()
Returns true only if all elements satisfy the given condition.
const values = [10, 20, 30];
const allAbove5 = values.every(v => v > 5);3. some()
Checks if at least one element satisfies the condition.
const ages = [15, 22, 30];
const hasMinor = ages.some(a => a < 18);4. filter()
Creates a new array of elements that pass the test.
const arr = [3, 8, 12];
const large = arr.filter(n => n > 5);5. forEach()
Runs a function for each element.
["red", "green", "blue"].forEach(c => console.log(c));6. indexOf()
Finds the first index of a value.
["dog", "cat"].indexOf("cat"); // 17. lastIndexOf()
Returns the last index of a value.
["a", "b", "a"].lastIndexOf("a"); // 28. join()
Creates a string from an array.
["x", "y", "z"].join("-");9. map()
Transforms each element and returns a new array.
[2, 4, 6].map(n => n * 2);10. pop()
Removes and returns the last element.
const items = [1, 2, 3];
items.pop(); // 311. push()
Adds elements to the end.
const stack = [1];
stack.push(2, 3);12. reduce()
Combines values into a single result.
[1, 2, 3].reduce((sum, n) => sum + n, 0);13. reduceRight()
Same as reduce, but right‑to‑left.
[1, 2, 3].reduceRight((a, b) => a + b);14. reverse()
Reverses the array in place.
[1, 2, 3].reverse(); // [3,2,1]15. shift()
Removes and returns the first element.
["first", "second"].shift();16. unshift()
Adds elements to the start.
const q = ["b"];
q.unshift("a");17. sort()
Sorts array values.
[4, 1, 3].sort((a, b) => a - b);18. splice()
Adds, removes, or replaces elements.
const f = ["a", "b", "c"];
f.splice(1, 1, "x"); // ["a","x","c"]19. toString()
Returns a comma‑separated string.
[1, 2].toString(); // "1,2"20. slice()
Returns a shallow copy of a portion.
["a", "b", "c"].slice(1, 3);21. Spread (...)
Expands array elements.
const base = [1, 2];
const extended = [...base, 3];22. includes()
Checks whether a value exists.
[1, 2, 3].includes(2); // true23. fill()
Fills elements with a static value.
[1, 2, 3].fill(0, 1, 3); // [1,0,0]24. flat()
Flattens arrays.
[1, [2], [3, [4]]].flat(2);25. flatMap()
Maps and flattens in one step.
[1, 2].flatMap(n => [n, n * 2]);26. at()
Accesses elements by positive or negative index.
[10, 20, 30].at(-1); // 30Static Array Methods
Array.isArray()
Checks if a value is an array.
Array.isArray([1, 2]); // trueArray.from()
Creates an array from iterables or array‑like objects.
Array.from("abc"); // ["a","b","c"]Array.of()
Creates a new array from the given arguments.
Array.of(5, 6); // [5, 6]Conclusion
These array methods cover most of what developers do when working with lists in JavaScript: searching, transforming, combining, flattening, and iterating. By relying on built‑in methods instead of manual loops, your code becomes more expressive, more functional, and easier to understand. Mastering these tools allows you to work efficiently with collections in any JavaScript environment.