读书人

js 面向对象学习六 几种面向对象写法的

发布时间: 2012-11-23 00:03:29 作者: rapoo

js 面向对象学习6 几种面向对象写法的对比
方法一

function Person(age,name){       this.age=age;       this.name=name;       if(typeof Person._initialized=='undefined'){             Person.prototype.showName=function(){                     console.log(this.name);             }             Person._initialized=true;        }}
?

开发者经过大量的实践在js面向对象编程中发现的比较科学的方法。

?

?

读书人网 >JavaScript

热点推荐