JS prototype 属性

String.prototype.trim=function(){
  return this.replace(/(^s*)|(s*$)/g, "");
}

原文地址:https://www.cnblogs.com/ok519/p/5185428.html