<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                企業??AI智能體構建引擎,智能編排和調試,一鍵部署,支持知識庫和私有化部署方案 廣告
                ```html <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>繼承</title> </head> <body> <script type="text/javascript"> // 1. 通過調用Person.call(this, name, age)繼承Person的成員,但不包括原型的成員 function Person(name, age) { this.type = "human"; this.name = name; this.age = age; this.getName = function() { console.log(this.name) } } function Student(name, age) { // 繼承Person所有的成員,但不包括原型的成員 Person.call(this, name, age); } var s1 = new Student("Jack", 21); console.log(s1.type, s1.name, s1.age); // human Jack 21 s1.getName(); // 21 </script> <script type="text/javascript"> // 2. 通過拷貝繼承原型的成員 function Person(name, age) { this.type = "human"; this.name = name; this.age = age; } Person.prototype.getName = function() { console.log(this.name); } function Student(name, age) { // 繼承Person所有的成員,但不包括原型的成員 Person.call(this, name, age); } for(var key in Person.prototype) { // 通過拷貝來繼承原型的成員 Student.prototype[key] = Person.prototype[key]; } var s1 = new Student("Jack", 21); s1.getName(); // Jack </script> <script type="text/javascript"> // 3. 利用原型特性繼承 function Person (name, age) { this.type = 'human' this.name = name this.age = age } Person.prototype.sayName = function () { console.log('hello ' + this.name) } function Student (name, age) { // 繼承Person的所有成員,但不包括原型中的成員 Person.call(this, name, age) } // 利用原型的特性實現繼承原型的所有成員 Student.prototype = new Person() var s1 = new Student('張三', 18) console.log(s1.type) // => human s1.sayName() // => hello 張三 </script> </body> </html> ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看