trim whitespace javascript

JavaScript
var str=" I have outer spaces ";
var cleanStr=str.trim();//trim() returns string with outer spaces removedyourvariable.trim()<div style="white-space:pre-wrap"> <!-- New Line -->
   <!-- 2 space --> This is my text
</div>
Source

Also in JavaScript: