JavaScript允许为语言的基本数据类型定义方法.通过Object.prototype添加原型方法,该方法可被所有的对象,.这样的方法对函数,数组,字符串,数字,正则表达式和布尔值都适用.例如,通过Function.prototype增加方法,使该方法对所有函数可用 Function.prototype.method=function(name,func){ this.prototype[name] = func return this } 为Function.prototype增加一个me…