在线文档教程

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]

规范

SpecificationStatusComment
ECMAScript 2015 (6th Edition, ECMA-262)The definition of 'TypedArray.prototype.reverse' in that specification.StandardInitial definition.
ECMAScript 2017 Draft (ECMA-262)The definition of 'TypedArray.prototype.reverse' in that specification.Draft

浏览器兼容性

FeatureChromeEdgeFirefox (Gecko)Internet ExplorerOperaSafari
Basic support451237 (37)No support3210

FeatureAndroidChrome for AndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Basic supportNo supportNo support37 (37)No supportNo support10