0
Q:

javascript trim

var str = "  Some text ";
str.trim();
// str = "Some text"
9
var str=" I have outer spaces ";
var cleanStr=str.trim();//trim() returns string with outer spaces removed
25
//Removing whitespace from String
 var str = "       Hello World!        ";
console.log(str.trim());
 
4

 var str = "       Hello World!        ";
alert(str.trim());
 
2
value = value.trim();
5
var str = "       Hello World!        ";
alert(str.trim());
5
yourvariable.trim()
3
var str = '/var/www/site/Brand new document.docx';

document.write( str.replace(/\s/g, '') );
0
<div style="white-space:pre-wrap"> <!-- New Line -->
   <!-- 2 space --> This is my text
</div>
-1

New to Communities?

Join the community