reverse()
メソッドは、その場で型付き配列を反転します。型付き配列の先頭の要素は末尾になり、末尾の要素は先頭になります。このメソッドは Array.prototype.reverse()
と同じアルゴリズムです。 TypedArray は、ここでは 型付き配列型のうちの一つです。
The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request.
構文
typedarray.reverse();
返値
反転された配列です。
例
reverse の使用
var uint8 = new Uint8Array([1, 2, 3]);
uint8.reverse();
console.log(uint8); // Uint8Array [3, 2, 1]
仕様書
ブラウザーの互換性
BCD tables only load in the browser