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