trim
trimEnd
trimStart
Removes whitespace from the end of a string.
str.trimEnd()
Enter values below to update the example in real time.
const
console
const text = " hello world "; console.log(text.trimEnd()); // " hello world"