The `trim()` method is used to remove any white space from both sides of a string value.
Note: the method does not change the original string value but creates a new one with all white spaces removed from both sides of the target string value.
String trim() Method Parameters:
The trim() method does not take any argument.
String trim() Method Return Value:
The returned value of this method is a copy of the target string value with white spaces removed from both sides.
Example: remove space from a string
const message = " Hello World! "; const res = message.trim(); console.log(res);