W3cubDocs

/JavaScript

TypedArray.prototype.toReversed()

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since ⁨July 2023⁩.

The toReversed() method of TypedArray instances is the copying counterpart of the reverse() method. It returns a new typed array with the elements in reversed order. This method has the same algorithm as Array.prototype.toReversed().

Syntax

toReversed()

Parameters

None.

Return value

A new typed array containing the elements in reversed order.

Description

See Array.prototype.toReversed() for more details. This method is not generic and can only be called on typed array instances.

Examples

>

Using toReversed()

const uint8 = new Uint8Array([1, 2, 3]);
const reversedUint8 = uint8.toReversed();
console.log(reversedUint8); // Uint8Array [3, 2, 1]
console.log(uint8); // Uint8Array [1, 2, 3]

Specifications

Browser compatibility

Desktop Mobile Server
Chrome Edge Firefox Opera Safari Chrome Android Firefox for Android Opera Android Safari on IOS Samsung Internet WebView Android WebView on iOS Bun Deno Node.js
toReversed 110 110 115 96 16 110 115 74 16 21.0 110 16 1.0.0 1.31 20.0.0

See also

© 2005–2025 MDN 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/toReversed