Array.prototype.keys: an index iterator
keys returns an iterator of consecutive indexes from zero, including indexes that are holes.
CKTIS / JavaScript
Programming syntax, operators and concepts. Find an explanation, explore an example and return to learning.
keys returns an iterator of consecutive indexes from zero, including indexes that are holes.
lastIndexOf finds the last matching index by searching existing elements backward from a chosen position.
map calls a callback for existing elements and creates a new result array with the same length.
pop removes the last position, shortens length, and returns its value or undefined for an empty array.
push appends any number of values from the current length and returns the receiver’s new length.
reduce visits existing elements and combines them through an accumulator into one value.
reduceRight combines existing elements into one value while visiting indexes from right to left.
reverse reverses index order in place, preserves sparse holes, and returns the same object.
shift removes index zero, moves remaining properties left, and returns the original first value.
slice creates a new shallow copy from start through exclusive end while preserving sparse holes.
some stops at the first truthy callback result and reports whether an existing element matched.
sort orders the elements of the same array, optionally with a comparison function, and returns that array object.
splice mutates an array at a selected position, shifts its tail, and returns a new array of removed elements.
toReversed creates a reversed shallow copy without changing the receiver and materializes holes as undefined.
toSorted stably sorts a new dense array while leaving the receiver and its original order unchanged.
toSpliced returns a new array after removing and inserting selected positions while leaving the receiver unchanged.
unshift shifts existing indexes right, inserts its arguments at the front, and returns the receiver’s new length.
values returns a live iterator that reads successive indexed values, including undefined produced by holes.
with returns a shallow dense copy with one value replaced at a specified positive or negative index.
BigInt64Array stores BigInt values as signed 64-bit integers and wraps them modulo 2^64.
BigUint64Array stores BigInt values as unsigned 64-bit integers and wraps them modulo 2^64.
DataView reads and writes multibyte values in a buffer with chosen byte order and no alignment requirement.
Date.now returns current wall-clock time as an integer number of milliseconds since the Unix epoch in UTC.
Date.parse converts date text to epoch milliseconds or returns NaN when the text is unrecognized or outside the supported range.