Skip to content

StdLib Array

Roger Johansson edited this page Jan 14, 2026 · 1 revision

Array

The Array built-in provides methods for creating and manipulating JavaScript arrays.

Implementation Status: 100% Complete

Overview

Category Methods Implemented
Static Methods 4 4
Iterator Methods 3 3
Transformation Methods 16 16
Iteration (HOF) Methods 11 11
Mutator Methods 8 8
Total 42 42

Static Methods (Array.xxx)

Method Status Description
Array.isArray(value) Implemented Checks if value is an array
Array.of(...items) Implemented Creates array from arguments
Array.from(arrayLike, mapFn, thisArg) Implemented Creates array from iterable/array-like
Array.fromAsync(asyncIterable, mapFn, thisArg) Implemented Creates array from async iterable (ES2024)
Array[Symbol.species] Implemented Returns constructor for derived objects

Iterator Methods

Method Status Description
entries() Implemented Returns iterator of [index, value] pairs
keys() Implemented Returns iterator of indices
values() Implemented Returns iterator of values
[Symbol.iterator] Implemented Alias for values()

Transformation Methods

Method Status Description
join(separator) Implemented Joins elements with separator
toString() Implemented Calls join() or Object.prototype.toString
includes(value, fromIndex) Implemented SameValueZero comparison
indexOf(value, fromIndex) Implemented Strict equality search
lastIndexOf(value, fromIndex) Implemented Reverse search
toLocaleString() Implemented Calls element toLocaleString methods
slice(start, end) Implemented Returns shallow copy of portion
at(index) Implemented Relative indexing (ES2022)
flat(depth) Implemented Flattens nested arrays
flatMap(callback) Implemented Maps and flattens one level
fill(value, start, end) Implemented Fills with value
copyWithin(target, start, end) Implemented Copies within array
toSorted(compareFn) Implemented Non-mutating sort (ES2023)
toReversed() Implemented Non-mutating reverse (ES2023)
toSpliced(start, deleteCount, ...items) Implemented Non-mutating splice (ES2023)
with(index, value) Implemented Non-mutating element replacement (ES2023)

Iteration (Higher-Order Function) Methods

Method Status Description
map(callback, thisArg) Implemented Creates new array with results
filter(callback, thisArg) Implemented Creates array with matching elements
reduce(callback, initialValue) Implemented Reduces to single value (left-to-right)
reduceRight(callback, initialValue) Implemented Reduces to single value (right-to-left)
forEach(callback, thisArg) Implemented Executes callback for each element
find(predicate, thisArg) Implemented Finds first matching element
findIndex(predicate, thisArg) Implemented Finds index of first match
some(predicate, thisArg) Implemented Tests if any element matches
every(predicate, thisArg) Implemented Tests if all elements match
findLast(predicate, thisArg) Implemented Finds last matching element (ES2023)
findLastIndex(predicate, thisArg) Implemented Finds index of last match (ES2023)

Mutator Methods (In-Place)

Method Status Description
push(...items) Implemented Adds elements to end
pop() Implemented Removes last element
shift() Implemented Removes first element
unshift(...items) Implemented Adds elements to beginning
splice(start, deleteCount, ...items) Implemented Removes/replaces/adds elements
reverse() Implemented Reverses in place
concat(...items) Implemented Merges arrays (@@isConcatSpreadable)
sort(compareFn) Implemented Sorts in place (stable)

Implementation Notes

Re-entrancy Guards

All mutator methods have protection against recursive calls:

// Internal __inMethodName__ flags prevent re-entry

Species Support

Methods that create new arrays respect Symbol.species for subclass compatibility.

Hole Handling

Methods correctly distinguish between holes (empty) and undefined values.

ES2023 Change-Array-by-Copy

The toSorted, toReversed, toSpliced, and with methods return new arrays without mutating the original.

Files

File Purpose
StdLib/Array/ArrayConstructor.cs Static methods
StdLib/Array/ArrayPrototype.cs Base prototype
StdLib/Array/ArrayPrototype.Transformations.cs Transformation methods
StdLib/Array/ArrayPrototype.Iterators.cs Iterator methods
StdLib/Array/ArrayPrototype.Iteration.cs HOF methods
StdLib/Array/ArrayPrototype.Mutators.cs Mutator methods

See Also

Clone this wiki locally