Array Creation & Manipulation
push(...items) → Adds elements to the end.
pop() → Removes the last element.
shift() → Removes the first element.
unshift(...items) → Adds elements to the beginning.
splice(start, deleteCount, item1, …) → Modifies the array by adding/removing elements.
let arr = [1, 2, 3, 4];
arr.splice(1, 2, "a", "b");
console.log(arr); // [1, "a", "b", 4]
fill(value, start?, end?) → Fills elements with a specified value.
let numbers = [1, 2, 3];
numbers.fill(0);
console.log(numbers); // [0, 0, 0]
reverse() → Reverses the array in place.
Array Access & Search
length → Returns or sets the number of elements in an array.
at(index) → Accesses an element using positive or negative index.
console.log([1, 2, 3].at(-1)); // 3
includes(item) → Checks if an item exists in the array.
indexOf(item) → Returns the index of the element (or -1 if not found).
find(callback) → Returns the first matching element.
findIndex(callback) → Returns the index of the first matching element.
some(callback) → Checks if at least one element satisfies a condition.
every(callback) → Checks if all elements satisfy a condition.