JavaScript Methods | interactive
☰
back to String methods
JavaScript String
trimEnd() method
removes whitespace from end of string
trimEnd() method removes whitespace from the end of a string.
trimEnd() does not accept any parameter.
trimEnd() method returns a new string.
trimEnd() method does not change the original string.
To return a new string with whitespace trimmed from just the start, use trimStart() method.
To return a new string with whitespace trimmed both ends of a string, use trim() method.
syntax description
remove whitespace from end of myString
↴
myString.trimEnd()