Add string starts With method using slice - Node.js String

Node.js examples for String:String Start

Description

Add string starts With method using slice

Demo Code

  String.prototype.startsWith = function (str){
    return this.slice(0, str.length) == str;
  };/*from  w  ww. j  av a 2  s. c  o m*/

Related Tutorials