str.trim() method is used to remove the white spaces from both the ends of the given string.
Syntax ...