Trim String in JavaScript
home
Run
screen_rotation
fullscreen
cloud_download
<html> <head> <title>Javascript Demo</title> <script type="text/javascript"> function trimExample() { var myString = " abc "; // string with space. alert("Original Length = "+myString.length); var result = myString.trim(); alert("Length after trim = "+result.length); } </script> </head> <body> <a href="javascript:void(0)" onclick="trimExample()">Run Example</a> </body> </html>
<html> <head> <title>Javascript Demo</title> <script type="text/javascript"> function trimExample() { var myString = " abc "; // string with space. alert("Original Length = "+myString.length); var result = myString.trim(); alert("Length after trim = "+result.length); } </script> </head> <body> <a href="javascript:void(0)" onclick="trimExample()">Run Example</a> </body> </html>
Copyrights@tutorialsplane.com