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

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

メモ

概要

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

外部リンク

構文

array.join( [separator] )

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

var array = [1, 2, 3, , 10];
console.log(array.join());      // 出力:1,2,3,,10
console.log(array.join("・"));  // 出力:1・2・3・・10

array = [1, [2, 3], , undefined, null, 10];
console.log(array.join());      // 出力:1,2,3,,,,10
console.log(array.join("・"));  // 出力:1・2,3・・・・10

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

メモ

概要

外部リンク

構文

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

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

var array = [1234, new Date()];
console.log(array.toLocaleString());   // 出力:1,234,20xx/xx/xx xx:xx:xx (ロケール 及び 実装依存)

Array.prototype.toString【文字列変換】

メモ

概要

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

外部リンク

構文

array.toString()

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

var array = [1234, new Date()];
console.log(array.toString());  // 出力:1234,Xxx Xxx xx 20xx xx:xx:xx GMT+0900 (東京 (標準時)) (ロケール 及び 実装依存)