Tutorialsplane

ReactJS Trim String


We can use JavaScript trim method to remove spaces from both end of the string. Here in this tutorial, we are going to explain how to use trim method in reactJs. You can also use our online editor to edit and run the code online.


ReactJS Trim String Method JavaScript Example

You can use JavaScript trim() function in ReactJs Simply as below-

Example:


Try it »

In the above example you can see string “Hellow World” contains blank space at the both end. If you check the length with space it will return 13, if you trim this string it will return length 11.

Output of above example-

ReactJs Blog