• <sub id="h4knl"><ol id="h4knl"></ol></sub>
    <sup id="h4knl"></sup>
      <sub id="h4knl"></sub>

      <sub id="h4knl"><ol id="h4knl"><em id="h4knl"></em></ol></sub><s id="h4knl"></s>
      1. <strong id="h4knl"></strong>

      2. javascript面向?qū)ο笾械膶ο笤趺蠢斫?/h1>
        時間:2024-09-02 07:15:39 JavaScript 我要投稿
        • 相關(guān)推薦

        javascript面向?qū)ο笾械膶ο笤趺蠢斫?/p>

          javacript面向?qū)ο蟪绦蛟O(shè)計(jì)中,可以理解為一切都是對象。實(shí)例代碼如下:

          復(fù)制代碼 代碼如下:

          function Cat(){

          }

          var cat1 = new Cat();//創(chuàng)建類實(shí)例

          cat1.name = "小狗";

          cat1.age = 4;

          cat1.color="白色";

          document.write(cat1.name);

          document.writeln(cat1.constructor);//實(shí)例化后對象,是對象

          document.writeln(typeof(cat1)+"

          ");

          document.writeln(Cat.constructor);//原型對象本身也是對象

          document.writeln(typeof Cat+"

          ");

          var b="hello";//字符串也是對象

          document.writeln(b.constructor);//輸出它的構(gòu)造函數(shù)

          document.writeln(typeof b+"

          ");

          var c=123;//數(shù)值也是對象

          document.writeln(c.constructor);

          document.writeln(typeof c+"

          ");

          判斷一個實(shí)例化對象是不是某個原型對象類型

          復(fù)制代碼 代碼如下:if(cat1 instanceof Cat){//與php的判斷方法相同

          window.alert("ok");

          }

          希望本文所述對大家的javascript程序設(shè)計(jì)有所幫助。

        【javascript面向?qū)ο笾械膶ο笤趺蠢斫狻肯嚓P(guān)文章:

        JavaScript中的三種對象04-01

        javascript克隆對象深度介紹03-31

        Javascript中arguments對象的詳解和使用方法03-31

        使用ajax操作JavaScript對象的方法03-08

        關(guān)于javascript對象之內(nèi)置和對象Math的使用方法03-30

        JavaScript高級程序設(shè)計(jì):本地對象Array03-29

        對javascript的理解03-29

        PHP面向?qū)ο笾剌d重寫的不同04-03

        在线咨询

        国产高潮无套免费视频_久久九九兔免费精品6_99精品热6080YY久久_国产91久久久久久无码
      3. <sub id="h4knl"><ol id="h4knl"></ol></sub>
        <sup id="h4knl"></sup>
          <sub id="h4knl"></sub>

          <sub id="h4knl"><ol id="h4knl"><em id="h4knl"></em></ol></sub><s id="h4knl"></s>
          1. <strong id="h4knl"></strong>

          2. 亚洲情涩免费手机在线视频 | 青娱乐极品视觉一区二区 | 亚洲AV乱码二区三区涩涩屋 | 久久精品国产乱子伦免费 | 欧美九九久久精品黄 | 西西人体44rt高清大胆亚洲 |

            javascript面向?qū)ο笾械膶ο笤趺蠢斫?/p>

              javacript面向?qū)ο蟪绦蛟O(shè)計(jì)中,可以理解為一切都是對象。實(shí)例代碼如下:

              復(fù)制代碼 代碼如下:

              function Cat(){

              }

              var cat1 = new Cat();//創(chuàng)建類實(shí)例

              cat1.name = "小狗";

              cat1.age = 4;

              cat1.color="白色";

              document.write(cat1.name);

              document.writeln(cat1.constructor);//實(shí)例化后對象,是對象

              document.writeln(typeof(cat1)+"

              ");

              document.writeln(Cat.constructor);//原型對象本身也是對象

              document.writeln(typeof Cat+"

              ");

              var b="hello";//字符串也是對象

              document.writeln(b.constructor);//輸出它的構(gòu)造函數(shù)

              document.writeln(typeof b+"

              ");

              var c=123;//數(shù)值也是對象

              document.writeln(c.constructor);

              document.writeln(typeof c+"

              ");

              判斷一個實(shí)例化對象是不是某個原型對象類型

              復(fù)制代碼 代碼如下:if(cat1 instanceof Cat){//與php的判斷方法相同

              window.alert("ok");

              }

              希望本文所述對大家的javascript程序設(shè)計(jì)有所幫助。