TypedArray.prototype.reverse()

reverse() 方法原地翻转类型化数组。类型化数组的第一个元素变为最后一个,最后一个变为第一个。这个方法的算法和 Array.prototype.reverse() 相同。TypedArray 是这里的类型化数组类型之一。

语法

reverse()

返回值

翻转的数组。

示例

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

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

规范

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

浏览器兼容性

BCD tables only load in the browser

另见