Get to know MDN better
このページはコミュニティーの尽力で英語から翻訳されました。MDN Web Docs コミュニティーについてもっと知り、仲間になるにはこちらから。
Since September 2025, this feature works across the latest devices and browser versions. This feature might not work in older devices or browsers.
Uint8Array.fromHex() は静的メソッドで、新しい Uint8Array オブジェクトを 16 進文字列から作成します。
このメソッドは、文字列をバイト配列に解釈します。文字列を単一の数値に変換するには、代わりに parseInt() 関数を、 radix を 16 に設定して使用してください。
Uint8Array に変換するバイト列をエンコードした 16 進文字列。文字列は次の条件を満たす必要があります。
16 進文字列からデコードされたバイトが含まれている新しい Uint8Array オブジェクト。
入力文字列に 16 進文字以外の文字が含まれているか、その長さが奇数の場合に発生します。
TypeError入力文字列が文字列でない場合に発生します。
この例では、16 進文字列を Uint8Array にデコードしています。
大文字も対応しています。
| ECMAScript® 2027 Language Specification # sec-uint8array.fromhex |
Enable JavaScript to view this browser compatibility table.
This page was last modified on 2025年7月19日 by MDN contributors.
Your blueprint for a better internet.
Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998–2026 by individual mozilla.org contributors. Content available under a Creative Commons license.