The element type.
Returns the arithmetic mean of a numeric sequence.
Returns NaN for an empty sequence.
Returns true if the sequence contains the given element (using ===).
The value to search for.
Returns the number of elements that satisfy the predicate. When called with no argument, returns the total number of elements.
Called with each element. Defaults to always-true.
Returns the element at the given zero-based index, or undefined if the index
is out of bounds.
Zero-based position.
Determines whether all the members of this iterator satisfy the specified test.
A function that accepts up to two arguments. The every method calls the predicate function for each element in this iterator until the predicate returns false, or until the end of this iterator.
Returns the first element matching the predicate, or undefined if none match.
When called with no argument, returns the first element or undefined for an empty sequence.
Called with (value, index) for each element. Defaults to always-true.
Returns the first element matching the predicate, or undefined if none match.
When called with no argument, returns the first element or undefined for an empty sequence.
Test applied to each element. Defaults to always-true.
Performs the specified action for each element in the iterator.
A function that accepts up to two arguments. forEach calls the callbackfn function one time for each element in the iterator.
Returns the zero-based index of the first occurrence of element (using ===),
or -1 if it is not found.
The value to search for.
Returns the zero-based index of the first element matching the predicate,
or -1 if none match.
Called with each element.
Returns the zero-based index of the last element matching the predicate,
or -1 if none match.
Called with each element.
Returns true if the sequence contains no elements.
Returns true if the sequence contains at least one element.
Joins all elements into a single string.
Optionaloptions: {Optionalpostfix?: stringString appended to the result. Defaults to "".
Optionalprefix?: stringString prepended to the result. Defaults to "".
Optionalseparator?: stringString placed between elements. Defaults to ", ".
Optionaltransform?: (value: T) => stringOptional function to convert each element to a string.
Defaults to String(value).
Returns the last element matching the predicate, or undefined if none match.
When called with no argument, returns the last element or undefined for an empty sequence.
Test applied to each element. Defaults to always-true.
Returns the maximum element using the natural > ordering, or undefined if the
sequence is empty.
Returns the minimum element using the natural < ordering, or undefined if the
sequence is empty.
Returns true if no element satisfies the predicate.
When called with no argument, returns true if the sequence is empty.
Test applied to each element. Defaults to always-true.
Calls the specified callback function for all the elements in this iterator. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.
Calls the specified callback function for all the elements in this iterator. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.
A function that accepts up to three arguments. The reduce method calls the callbackfn function one time for each element in the iterator.
If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of a value from the iterator.
OptionalreturnOptionalvalue: undefinedReturns true if any element satisfies the predicate.
When called with no argument, returns true if the sequence is non-empty.
Test applied to each element. Defaults to always-true.
Returns the sum of all elements in a numeric sequence.
Returns 0 for an empty sequence.
Returns the sum of the values returned by selector for each element.
Returns 0 for an empty sequence.
Extracts a numeric value from each element.
OptionalthrowOptionale: anyCreates a new array from the values yielded by this iterator.
Returns a sequence of sliding windows of the given size.
The number of elements in each window. Must be ≥ 1.
How many elements to advance the window each time. Defaults to 1.
When true, windows smaller than size at the end are included.
Defaults to false.
Returns a sequence of pairs built by combining the elements of this sequence
with elements from other. Stops when the shorter sequence is exhausted.
An optional transform function can produce a different type from each pair.
The element type of other.
The iterable to zip with.
Returns a sequence of pairs built by combining the elements of this sequence
with elements from other. Stops when the shorter sequence is exhausted.
An optional transform function can produce a different type from each pair.
The element type of other.
The result type when transform is provided.
StaticfromCreates a native iterator from an iterator or iterable object. Returns its input if the input already inherits from the built-in Iterator class.
A lazy sequence of elements that wraps a native
Iterator<T>.Operations on a
Sequenceare evaluated lazily — intermediate operations (e.g.filter,map) build up a pipeline and produce no results until a terminal operation (e.g.toArray,fold,count) consumes the iterator.Example