Javascript中的prototype
摘要:Js中的prototype一直对prototype理解的不深,只是晓得如果一个类(实际上是类的构造函数)通过prototype来定义一个函数,那么通过这个类衍生的实例就可以直接使用这个方法。比如:function Person(name){ this.name=name; this.showMe=function(){ alert(this.name); }};Person.prototype.from=function() { alert('I come from prototype.');} var one=new Person('js');one.show
阅读全文
posted @ 2012-12-10 10:08