typedArray.reverse
typedArray.reverse
reverse()
方法原地翻转类型化数组。类型化数组的第一个元素变为最后一个,最后一个变为第一个。这个方法的算法和Array.prototype.reverse()
相同。TypedArray
是这里的类型化数组类型之一。
语法
typedarray.reverse(
返回值
翻转的数组。
示例
var uint8 = new Uint8Array([1, 2, 3]
uint8.reverse(
console.log(uint8 // Uint8Array [3, 2, 1]
规范
Specification | Status | Comment |
---|---|---|
ECMAScript 2015 (6th Edition, ECMA-262)The definition of 'TypedArray.prototype.reverse' in that specification. | Standard | Initial definition. |
ECMAScript 2017 Draft (ECMA-262)The definition of 'TypedArray.prototype.reverse' in that specification. | Draft | |
浏览器兼容性
Feature | Chrome | Edge | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|---|
Basic support | 45 | 12 | 37 (37) | No support | 32 | 10 |
Feature | Android | Chrome for Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|
Basic support | No support | No support | 37 (37) | No support | No support | 10 |