TypedArray.prototype.reverse()

The reverse() method reverses a typed array in place. The first typed array element becomes the last and the last becomes the first. This method has the same algorithm as Array.prototype.reverse(). TypedArray is one of the typed array types here.

Try it

Syntax

reverse()

Return value

The reversed array.

Examples

Using reverse

const uint8 = new Uint8Array([1, 2, 3]);
uint8.reverse();

console.log(uint8); // Uint8Array [3, 2, 1]

Specifications

Specification
ECMAScript Language Specification
# sec-%typedarray%.prototype.reverse

Browser compatibility

BCD tables only load in the browser

See also