Javascript String trimLeft()

Description

Javascript String trimLeft()


String.prototype.trimLeft = function ()
{
    return this.replace(/^\s+/, "");
};

Javascript String trimLeft()

// This function removes all spaces at the beginning of a string
String.prototype.trimLeft = function() {
 return this.replace(/^\s+/, ''); 
};

Javascript String trimLeft()

String.prototype.trimLeft = function()
{
    return this.replace(/(^\s*)/g, "");
}

Javascript String trimLeft()

String.prototype.trimLeft = String.prototype.trimLeft || function() {
  return this.replace(/^\s+/,'');
};



PreviousNext

Related