if (typeof String.prototype.startsWith != 'function') {
  String.prototype.startsWith = function (prefix){
  return this.slice(0, prefix.length) === prefix;
  };
}

 

if (typeof String.prototype.endsWith != 'function') {
 String.prototype.endsWith = function(suffix) {
 return this.indexOf(suffix, this.length - suffix.length) !== -1;
 };
}

 

相关文章:

  • 2021-10-29
  • 2021-11-18
  • 2021-05-25
  • 2021-06-03
  • 2021-08-19
  • 2021-09-03
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-05-24
  • 2021-08-10
  • 2022-12-23
  • 2021-04-16
相关资源
相似解决方案