Javascript-array-constructor

提供:Dev Guides
移動先:案内検索

JavaScript-配列コンストラクタープロパティ

説明

JavaScript配列の constructor プロパティは、インスタンスのプロトタイプを作成した配列関数への参照を返します。

構文

その構文は次のとおりです-

array.constructor

戻り値

このオブジェクトのインスタンスを作成した関数を返します。

次の例を試してください。

<html>
   <head>
      <title>JavaScript Array constructor Property</title>
   </head>

   <body>

      <script type = "text/javascript">
        var arr = new Array( 10, 20, 30 );
        document.write("arr.constructor is:" + arr.constructor);
      </script>

   </body>
</html>

出力

arr.constructor is: function Array() { [native code] }