startsWith

if (!String.prototype.startsWith) {
  Object.defineProperty(String.prototype, 'startsWith', {
    enumerable: false,
    configurable: false,
    writable: false,
    value: function (searchString, position) {
      position = position || 0;
      return this.indexOf(searchString, position) === position;
    }
  });
}
//大拿拿了一个这样的代码出来,你妈,,吓死我了,,这不科学啊
而且 this.indexOf(searchString, position) === position;这句感觉有问题

  

原文地址:https://www.cnblogs.com/diligenceday/p/3741158.html