| [ Web Proxy ] |
| Viewing: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/reverse | [Back] [Original] |
Get to know MDN better
This feature is well established and works across many devices and browser versions. Its been available across browsers since September 2016.
The reverse() method of TypedArray instances reverses a typed array in place and returns the reference to the same typed array, the first typed array element now becoming the last, and the last typed array element becoming the first. In other words, elements order in the typed array will be turned towards the direction opposite to that previously stated. This method has the same algorithm as Array.prototype.reverse().
const uint8 = new Uint8Array([1, 2, 3]);
uint8.reverse();
console.log(uint8);
// Expected output: Uint8Array [3, 2, 1]
reverse()
None.
The reference to the original typed array, now reversed. Note that the typed array is reversed in place, and no copy is made.
See Array.prototype.reverse() for more details. This method is not generic and can only be called on typed array instances.
const uint8 = new Uint8Array([1, 2, 3]);
uint8.reverse();
console.log(uint8); // Uint8Array [3, 2, 1]
| Specification |
|---|
| ECMAScript 2027 LanguageSpecification # sec-%typedarray%.prototype.reverse |
TypedArray.prototype.reverse in core-jsTypedArrayTypedArray.prototype.join()TypedArray.prototype.sort()TypedArray.prototype.toReversed()Array.prototype.reverse()This page was last modified on Jul 10, 2025 by MDN contributors.
TypedArrayObject/FunctionBigInt64ArrayBigUint64ArrayFloat16ArrayFloat32ArrayFloat64ArrayInt8ArrayInt16ArrayInt32ArrayUint8ArrayUint8ClampedArrayUint16ArrayUint32ArrayYour blueprint for a better internet.
Portions of this content are 19982026 by individual mozilla.org contributors. Content available under a Creative Commons license.
| Web Proxy Viewer | New URL | Original Page |