JavaScript文字列trimEnd
trim

trimEnd文字列

trimStart

末尾の空白を削除します。

構文

str.trimEnd()

使用例

下記の値を入力するとサンプルに即時反映されます。

const
console
trimEnd
const text = "  hello world  ";
console.log(text.trimEnd());   // "  hello world"