Skip to content

Add missing Array.prototype methods (find, fill, findIndex, etc.) #37

@memburg

Description

@memburg

Summary

Implement the remaining commonly-used Array.prototype methods that are currently absent.

Motivation

~25 Array methods are already implemented (map, filter, reduce, forEach, flat, flatMap, splice, etc.). Filling the gaps with the most practical missing methods improves compatibility with real-world JS code.

Priority order (by practical usage)

High:

  • fill(value, start?, end?)
  • find(predicate, thisArg?)
  • findIndex(predicate, thisArg?)

Medium:

  • entries() — returns an iterator (can be a simple array of [index, value] pairs)
  • keys() — returns an iterator
  • values() — returns an iterator
  • copyWithin(target, start, end?)
  • reduceRight(callback, initialValue?)

Low:

  • findLast(predicate, thisArg?)
  • findLastIndex(predicate, thisArg?)
  • Array.from(arrayLike)
  • Array.fromAsync(arrayLike) — requires async support

Out of scope

  • toReversed, toSorted, toSpliced, with (ES2023 immutable variants — lower priority)
  • toLocaleString

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions