1. Use regular expressions to implement startWith and endWith effect functions
String.prototype.startWith=function(str){
var reg=new RegExp("^" str);
return reg.test(this);
}
//Test ok, directly Just use str.endWith("abc") to call
String.prototype.endWith=function(str){
var reg=new RegExp(str "$");
return reg.test( this);
}
2. JavaScript implements startWith and endWith effect functions