标签:const play 存在 fun 下划线 img cto 定义 inf
1 //函数对象Person 2 function Person(name){ 3 this.name = name; 4 } 5 console.log(Person.prototype); 6 7 //实例对象person1 8 var person1 = new Person(); 9 console.log(person1.__proto__);
1 //函数对象Person 2 function Person(name,age){ 3 this.name = name; 4 this.age = age; 5 this.eat = function(){ 6 console.log("eat"); 7 } 8 } 9 10 Person.prototype.play = function(){ 11 console.log("play"); 12 } 13 14 //原型对象 15 var person1 = new Person(); 16 var person2 = new Person(); 17 18 console.log(person1);
标签:const play 存在 fun 下划线 img cto 定义 inf
原文地址:https://www.cnblogs.com/zhihaospace/p/12000276.html