// addMethod - By John Resig (MIT Licensed)functionaddMethod(object,name,fn){varold=object[name];object[name]=function(){if(fn.length==arguments.length){returnfn.apply(this,arguments);}elseif(typeofold==’function’){returnold.apply(this,arguments);}}};varUserInfo=function(){addMethod(this,”find”,function(){alert(”没有参数”);});addMethod(this,”find”,function(name){alert(”传入的参数是一个,叫”+name);});addMethod(this,”find”,function(name,value){alert(”传入了两个参数,一个叫name=”+name+”一个叫value=”+value);});};varuserinfo=newUserInfo();userinfo.find();userinfo.find(’我是谁?’);userinfo.find(’某某某’,’1512412514’);