指定した長さになるよう文字を先頭・末尾に埋める
'5'.padStart(3, '0'); // '005' 'hi'.padEnd(5, '!'); // 'hi!!!' '42'.padStart(6); // ' 42' (デフォルトはスペース) const hh = String(hours).padStart(2, '0'); // '09'
コード番号のゼロ埋めや整形した表示に便利。第2引数が複数文字の場合は必要な長さに切り詰められる。
split()
replace() / replaceAll()
includes() / startsWith() / endsWith()
trim() / trimStart() / trimEnd()
前の関数
次の関数
match() / matchAll()