JavaScript String trim() method
In this Tutorial, we will learn about JavaScript String trim() method with the help of following below:
The trim() method removes the white spaces from the beginning and end of the string.
Example1
Output
trimStart() and trimLeft() method
The trimStart() and trimLeft() method will remove the white spaces from the beginning of the strings.
Syntax
var result = string.trimStart();
Example2
Output
var result = string.trimLeft();
Example3
Output