constructor

 1 function Person(name){
 2     this.name = name;
 3 }
 4 Person.prototype = {
 5     constructor : Person,
 6 
 7     sayName : function(){
 8         console.info(this.name);
 9     },
10 
11     toString : function(){
12         return "[Person "+this.name+"]";
13     }
14 }

 

posted @ 2016-07-10 18:51  ^^-^^-  阅读(119)  评论(0编辑  收藏  举报