Widely availableSupported across all major browsers. Safe to use in production.

Overview

Typed array iteration methods

Browser support

Feature Desktop Mobile
Chrome
Edge
Firefox
Safari
Chrome Android
Safari iOS
45
12
37
10
45
10
Built-in object

The filter() method of TypedArray instances creates a copy of a portion of a given typed array, filtered down to just the elements from the given typed array that pass the test implemented by the provided function. This method has the same algorithm as Array.prototype.filter().

45
12
38
10
45
10

The forEach() method of TypedArray instances executes a provided function once for each typed array element. This method has the same algorithm as Array.prototype.forEach().

45
12
38
10
45
10

The indexOf() method of TypedArray instances returns the first index at which a given element can be found in the typed array, or -1 if it is not present. This method has the same algorithm as Array.prototype.indexOf().

45
12
37
10
45
10

The lastIndexOf() method of TypedArray instances returns the last index at which a given element can be found in the typed array, or -1 if it is not present. The typed array is searched backwards, starting at fromIndex. This method has the same algorithm as Array.prototype.lastIndexOf().

45
12
37
10
45
10

The map() method of TypedArray instances creates a new typed array populated with the results of calling a provided function on every element in the calling typed array. This method has the same algorithm as Array.prototype.map().

45
12
38
10
45
10

The reduce() method of TypedArray instances executes a user-supplied "reducer" callback function on each element of the typed array, in order, passing in the return value from the calculation on the preceding element. The final result of running the reducer across all elements of the typed array is a single value. This method has the same algorithm as…

45
12
37
10
45
10

The reduceRight() method of TypedArray instances applies a function against an accumulator and each value of the typed array (from right-to-left) to reduce it to a single value. This method has the same algorithm as Array.prototype.reduceRight().

45
12
37
10
45
10

The some() method of TypedArray instances returns true if it finds an element in the array that satisfies the provided testing function. Otherwise, it returns false. This method has the same algorithm as Array.prototype.some().

45
12
37
10
45
10
1+Supported (version) Not supported Has note Sub-feature descriptions sourced from MDN Web Docs (CC BY-SA 2.5)
Notes 1 item(s)
Implementation note
  • Starting with Firefox 47, this method will no longer return `-0`. For example, `new Uint8Array([0]).indexOf(0, -0)` will now always return `+0`.
Notes 1 item(s)
Implementation note
  • Starting with Firefox 47, this method will no longer return `-0`. For example, `new Uint8Array([0]).lastIndexOf(0, -0)` will now always return `+0`.

Syntax

JAVASCRIPT
// Typed array iteration methods example
// See MDN Web Docs for details

Live demo

TypedArray forEach / map / filter

also usable. with Normal. Array and sameiterationmethod that TypedArray.

PreviewFullscreen

find / findIndex / some / every

conditionmatchng typemethod also usepossible.

PreviewFullscreen

Normalarray and. Difference

TypedArray Iteration to is type that exists.

PreviewFullscreen

Use cases

  • Using Typed array iteration methods

    Typed array iteration methods

Cautions

  • No specific concerns. Stable across all major browsers.

Accessibility

  • When updating the DOM dynamically, announce important changes to assistive technology with aria-live regions.

Powered by web-features