prototype是对对象的原型指定新的方法.比如:
String.prototype.Trim=function() {return this.replace(/(^\s*|\s*$)/g,"")}
只要一个对象的类型是String(即typeof(objectName)=="string"||objectName.constructor==String),那么它就可以使用Trim方法.比如" abc ".Trim()="abc"
String.prototype.Trim=function() {return this.replace(/(^\s*|\s*$)/g,"")}
只要一个对象的类型是String(即typeof(objectName)=="string"||objectName.constructor==String),那么它就可以使用Trim方法.比如" abc ".Trim()="abc"
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货