.trim()
Remove existing whitespace from both ends of a string.
Syntax
string.trim();
Example
Removing all existing whitespace from both ends of a string using .trim()
method:
console.log(' Hello World '.trim());// Output: Hello World
Contributors
- Anonymous contributors