![]() |
VOOZH | about |
This article demonstrates trimEnd and trimRight methods of JavaScript string. Both methods are used to perform the same task and their implementation is shown below:
The trimStart() method in JavaScript is used to remove whitespace from the beginning of a string. The value of the string is not modified in any manner, including any whitespace present after the string.
string.trimStart();
It returns the final string that is stripped out of all the white space in the beginning.
Example: This example implements the trimStart() method.
"GeeksforGeeks " "Hello There! "
The trimStart() method has an alias which is the trimLeft() method. It performs exactly the same function as the trimStart() method.
string.trimLeft();
It returns the final string that is stripped out of all the white space in the beginning.
Example: This example implements the trimLeft() method.
"GeeksforGeeks " "Portal "
We have a complete list of Javascript Strings, to check those please go through the article.
Supported Browsers: The browsers supported by trimStart() method are listed below: