join【全要素文字列結合】
toLocaleString【文字列変換 (ロケール)】
toString【文字列変換】

%TypedArray%.prototype.join【全要素文字列結合】

メモ

概要

  • 全配列要素を文字列変換し、区切り文字列結合

関連

外部リンク

構文

typedArray.join( [separator] )

全配列要素を区切り文字列で結合した文字列
separator区切り文字列 (省略:",")

const array = [0, 1, 2, 3, 4];
const typedArray = new Int32Array(array);
console.log( typedArray );             // 出力:Int32Array(5) [0, 1, 2, 3, 4, (省略) ]
console.log( typedArray.join() );      // 出力:0,1,2,3,4
console.log( typedArray.join(', ') );  // 出力:0, 1, 2, 3, 4
console.log( typedArray.join('--') );  // 出力:0--1--2--3--4

%TypedArray%.prototype.toLocaleString【文字列変換 (ロケール)】

メモ

概要

関連

外部リンク

構文

typedArray.toLocaleString(  ) 
typedArray.toLocaleString( [reserved1[, reserved2]] ) 

変換文字列 (ロケール 及び 実装依存)
reserved1リザーブ1 (実装依存)
reserved2リザーブ2 (実装依存)

const array = [1, 123, 12345, 1234567];
const typedArray = new Int32Array(array);
console.log( typedArray );
// 出力:Int32Array(4) [1, 123, 12345, 1234567, (省略) ]
console.log( typedArray.toLocaleString() );
// 出力:1,123,12,345,1,234,567

// 実装依存
console.log( typedArray.toLocaleString('de-DE') );  // ドイツ語 (桁区切り:ドット)
// 出力:1,123,12.345,1.234.567

%TypedArray%.prototype.toString【文字列変換】

メモ

概要

  • 文字列変換 (実装依存)
    • 各要素は、要素のtoString【文字列変換】で変換

関連

外部リンク

構文

typedArray.toString()

配列を表現した文字列 (ロケール 及び 実装依存)

const array = [1, 123, 12345, 1234567];
const typedArray = new Int32Array(array);
console.log( typedArray );
// 出力:Int32Array(4) [1, 123, 12345, 1234567, (省略) ]
console.log( typedArray.toString() );
// 出力:1,123,12345,1234567