var string1 = "foobar"; var string2 = string1.substr(1); console.log(string2); // shows "oobar" var string = "//www.pipi.com"; while(string.charAt(0) === '/') { //take character position 0 string = string.substr(1); }