サイト内検索

Boolean プロパティ一覧

スポンサー

ホーム > Boolean > prototype

prototype

オブジェクトにプロパティを追加します.

シンタックス

object.prototype.name = value

サンプルコード

以下にprototypeプロパティを使用したサンプルコードを示します.

<html>
  <head>
    <title>prototypeプロパティのサンプルコード</title>
  </head>
  <body>
    <script type="text/javascript" language="javascript">
      /* Booleanオブジェクトにプロパティを追加 */
      Boolean.prototype.x;
      Boolean.prototype.y;

      var isTest = new Boolean(true);
      isTest.x = 1;
      isTest.y = 2;

      document.write(isTest + "<br />");
      document.write(isTest.x + "<br />");
      document.write(isTest.y + "<br />");
    </script>
  </body>
</html>

実行例

サンプルコードの実行結果は以下のようになります.

true
1
2

スポンサード リンク

inserted by FC2 system