Typed Array reverse()
Example
// Create a Typed Array
const myArr = Int16Array.from([10,15,20,25,30,35,40,45,50]);
// Reverse the array
myArr.reverse();
Try it Yourself »
Description
The reverse()
method reverses a typed array in place.
The reverse()
method overwrites the original array.
Typed Array Sort Methods:
Method | Finds |
---|---|
reverse() | Reverses the order of the elements in an array |
sort() | Sorts the order of the elements in an array |
toReversed() | Reverses the elements of an array into a new array |
toSorted() | Sorts the elements of an array into a new array |
Syntax
typed-array.reverse()
typed-array must be one of the following: Int8ArrayUint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float16Array Float32Array Float64Array BigInt64Array BigUint64Array |
Parameters
NONE |
Return Value
Type | Description |
Typed Array | The original array reversed in place. |
JavaScript Typed Arrays
Browser Support
typed-array.reverse()
is an ECMAScript6 (ES6 2015) feature.
JavaScript 2015 is fully supported in all modern browsers since June 2017:
Chrome 51 | Edge 15 | Firefox 54 | Safari 10 | Opera 38 |
May 2016 | Apr 2017 | Jun 2017 | Sep 2016 | Jun 2016 |