| 1234567891011121314151617181920212223242526272829303132333435363738 | 
							- <!DOCTYPE html>
 
- <html lang="en">
 
-   <head>
 
-     <meta charset="UTF-8" />
 
-     <meta name="viewport" content="width=device-width, initial-scale=1.0" />
 
-     <title>Document</title>
 
-   </head>
 
-   <body>
 
-     <!-- 
 
-         函数 中 写属性
 
-         原型 中 写方法
 
-     
 
-     -->
 
-     <script>
 
-       function Person(name, age) {
 
-         this.name = name;
 
-         this.age = age;
 
-       }
 
-       Person.prototype.eat = function() {
 
-         console.log("吃东西")
 
-       }
 
-       let p1 = new Person("暖宝宝", 10);
 
-       console.log(p1);
 
-       console.log(Person.prototype.constructor);
 
-       /**
 
-        * 继承父类的方法:
 
-        * 1.子类的构造函数里:通过调用的父类.call(this,xxxx)
 
-        * 2.子类的原型等于父类的实例化对象
 
-       */
 
-       function Fn1(name,age) {
 
-         Person.apply(this,[name,age])
 
-       }
 
-       Fn1.prototype = new Person();
 
-       var fn1 = new Fn1("小明",5);
 
-       console.log(fn1)
 
-     </script>
 
-   </body>
 
- </html>
 
 
  |