Javascript-string-tostring

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

JavaScript文字列-toString()メソッド

説明

このメソッドは、指定されたオブジェクトを表す文字列を返します。

構文

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

string.toString( )

戻り値

指定されたオブジェクトを表す文字列を返します。

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

<html>
   <head>
      <title>JavaScript String toString() Method</title>
   </head>

   <body>
      <script type = "text/javascript">
         var str = "Apples are round, and Apples are Juicy.";
         document.write(str.toString( ));
      </script>
   </body>
</html>

出力

Apples are round, and Apples are Juicy.