JS 扩展方法prototype时间:2023-03-10 00:07:11 通过类对象的prototype设置扩展方法,下面为String对象增加quote(两边加字符)方法 <script type="text/javascript"> String.prototype.isEmail= function(){ return this.indexOf('@')!=-1?true:false; } alert('dxm@163.com'.isEmail()); </script>