Javascript-string-constructor

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

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

説明

コンストラクターは、インスタンスのプロトタイプを作成した文字列関数への参照を返します。

構文

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

string.constructor

戻り値

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

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

<html>
   <head>
      <title>JavaScript String constructor Method</title>
   </head>

   <body>
      <script type = "text/javascript">
         var str = new String( "This is string" );
         document.write("str.constructor is:" + str.constructor);
      </script>
   </body>
</html>

出力

str.constructor is: function String() { [native code] }