文字列→16進数の文字列split() で配列にする → map() で各要素に charCodeAt(0) して数値 (UTF-16コード、0~65535) に変換 → 数値に toString(16) で16進表記の文字列に変換 → join() で結合。 文字列const hexStr = 'ABCDかきくけ'.split('').map(v => v.charCodeAt(0).toString(16)).join(' '); console.log(hexStr); // -> 41 42 43 44 304b 304d 304f 3051TypedArray|Buffer →16進数の文字列reduce() で各要素を toString(16) しながら結合。 TypedArray// Uint16Array生成 const uint16Array = Uint16Array.

