W3cubDocs

/JavaScript

TypedArray.prototype

The TypedArray.prototype property represents the prototype for TypedArray constructors.

Property attributes of TypedArray.prototype
Writable no
Enumerable no
Configurable no

Description

TypedArray instances inherit from TypedArray.prototype. You can use the constructor's prototype object to add properties or methods to all TypedArray instances, where TypedArray is one of the typed array types.

See also the description about TypedArray for more information about inheritance.

Properties

TypedArray.prototype.constructor
Returns the function that created an instance's prototype. This is one the corresponding typed array type functions by default.
TypedArray.prototype.buffer Read only
Returns the ArrayBuffer referenced by the typed array. Fixed at construction time and thus read only.
TypedArray.prototype.byteLength Read only
Returns the length (in bytes) of the typed array from the start of its ArrayBuffer. Fixed at construction time and thus read only.
TypedArray.prototype.byteOffset Read only
Returns the offset (in bytes) of the typed array from the start of its ArrayBuffer. Fixed at construction time and thus read only.
TypedArray.prototype.length Read only
Returns the number of elements hold in the typed array. Fixed at construction time and thus read only.

Methods

TypedArray.prototype.copyWithin()
Copies a sequence of array elements within the array. See also Array.prototype.copyWithin().
TypedArray.prototype.entries()
Returns a new Array Iterator object that contains the key/value pairs for each index in the array. See also Array.prototype.entries().
TypedArray.prototype.every()
Tests whether all elements in the array pass the test provided by a function. See also Array.prototype.every().
TypedArray.prototype.fill()
Fills all the elements of an array from a start index to an end index with a static value. See also Array.prototype.fill().
TypedArray.prototype.filter()
Creates a new array with all of the elements of this array for which the provided filtering function returns true. See also Array.prototype.filter().
TypedArray.prototype.find()
Returns the found value in the array, if an element in the array satisfies the provided testing function or undefined if not found. See also Array.prototype.find().
TypedArray.prototype.findIndex()
Returns the found index in the array, if an element in the array satisfies the provided testing function or -1 if not found. See also Array.prototype.findIndex().
TypedArray.prototype.forEach()
Calls a function for each element in the array. See also Array.prototype.forEach().
TypedArray.prototype.includes()
Determines whether a typed array includes a certain element, returning true or false as appropriate. See also Array.prototype.includes().
TypedArray.prototype.indexOf()
Returns the first (least) index of an element within the array equal to the specified value, or -1 if none is found. See also Array.prototype.indexOf().
TypedArray.prototype.join()
Joins all elements of an array into a string. See also Array.prototype.join().
TypedArray.prototype.keys()
Returns a new Array Iterator that contains the keys for each index in the array. See also Array.prototype.keys().
TypedArray.prototype.lastIndexOf()
Returns the last (greatest) index of an element within the array equal to the specified value, or -1 if none is found. See also Array.prototype.lastIndexOf().
TypedArray.prototype.map()
Creates a new array with the results of calling a provided function on every element in this array. See also Array.prototype.map().
TypedArray.prototype.move() Unimplemented
Former non-standard version of TypedArray.prototype.copyWithin().
TypedArray.prototype.reduce()
Apply a function against an accumulator and each value of the array (from left-to-right) as to reduce it to a single value. See also Array.prototype.reduce().
TypedArray.prototype.reduceRight()
Apply a function against an accumulator and each value of the array (from right-to-left) as to reduce it to a single value. See also Array.prototype.reduceRight().
TypedArray.prototype.reverse()
Reverses the order of the elements of an array — the first becomes the last, and the last becomes the first. See also Array.prototype.reverse().
TypedArray.prototype.set()
Stores multiple values in the typed array, reading input values from a specified array.
TypedArray.prototype.slice()
Extracts a section of an array and returns a new array. See also Array.prototype.slice().
TypedArray.prototype.some()
Returns true if at least one element in this array satisfies the provided testing function. See also Array.prototype.some().
TypedArray.prototype.sort()
Sorts the elements of an array in place and returns the array. See also Array.prototype.sort().
TypedArray.prototype.subarray()
Returns a new TypedArray from the given start and end element index.
TypedArray.prototype.values()
Returns a new Array Iterator object that contains the values for each index in the array. See also Array.prototype.values().
TypedArray.prototype.toLocaleString()
Returns a localized string representing the array and its elements. See also Array.prototype.toLocaleString().
TypedArray.prototype.toString()
Returns a string representing the array and its elements. See also Array.prototype.toString().
TypedArray.prototype[@@iterator]()
Returns a new Array Iterator object that contains the values for each index in the array.

Specifications

Browser compatibility

Feature Chrome Edge Firefox Internet Explorer Opera Safari
Basic support 7 Yes 4 10 11.6 5.1
Feature Android webview Chrome for Android Edge mobile Firefox for Android IE mobile Opera Android iOS Safari
Basic support 4 Yes Yes 4 10 11.6 4.2

See also

© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/prototype