trimEnd()
ES2019+Removes whitespace from the end of a string.
Syntax
string.trimEnd()Return Value
string
A new string with whitespace removed from the end
Examples
JavaScript
const str = 'Hello ';
console.log(str.trimEnd()); Output:
// 'Hello'