Javascript String startsWith(searchString, position)

Description

Javascript String startsWith(searchString, position)


String.prototype.startsWith = String.prototype.startsWith || function startsWith(searchString, position) {
   position = position || 0;// ww  w  . j av a 2s .c  o  m

    return this.indexOf(searchString, position) === position;
};

Javascript String startsWith(searchString, position)

String.prototype.startsWith = function (searchString, position) {
    position = position || 0;/*from w  ww  . j a v a2  s.c  o m*/
    return this.substr(position, searchString.length) === searchString;
};



PreviousNext

Related