Here you can find the source of ltrim()
var s1 = new String(' A B '); //s1.ltrim = function(){ String.prototype.ltrim = function(){ var regexp = /^\s*/; var result = this.replace(regexp, ''); return result; }; console.log('||'+s1.ltrim()+'||');
String.prototype.ltrim = function() { return this.replace(/^\s+/,""); };
String.prototype.ltrim = function() { return this.replace(/^\s+/g,"");
String.prototype.ltrim = function() { return this.replace(/^\s*/g,'');
String.prototype.ltrim=function() return this.replace(/(^\s*)/g,'');
String.prototype.ltrim = function() { return this.replace(/(^\s*)/g, "");
String.prototype.ltrim = function() { return this.replace(/^\s+/,'');