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 }
原文地址:https://www.cnblogs.com/zhanghuiyun/p/5658340.html