<script>
var x= ' jay bharat ';
alert(x.length);
var y = x.replace(/^\s+|\s+$/g,"");
alert(y.length);
</script>

Share on Facebook