|
説明
- 「new」で作られたオブジェクトに,明示的にプロパティ追加するプロパティ。
- 用例では,「new」で作られたtodayオブジェクトに対し,「prototype」プロパティを使って「MyPrototype」というプロパテイを新に作成している。
- サポートしているオブジェクト(配列)
Arrayオブジェクト Booleanオブジェクト Dateオブジェクト Functionオブジェクト Imageオブジェクト Numberオブジェクト Stringオブジェクト ユーザー作成オブジェクト
用例
<script type="text/javascript"> <!-- today = new Date(); Date.prototype.MyPrototype="ただ今の日時は:".bold(); document.write(today.MyPrototype + today.toLocaleString()); //--> </script>