Javascript-boolean-tostring

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

JavaScript-ブールtoString()メソッド

説明

このメソッドは、オブジェクトの値に応じて「true」または「false」の文字列を返します。

構文

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

boolean.toString()

戻り値

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

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

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

   <body>
      <script type = "text/javascript">
         var flag = new Boolean(false);
         document.write( "flag.toString is : " + flag.toString() );
      </script>
   </body>
</html>

出力

flag.toString is : false