Number.prototype

書式

Number.prototype

説明

Numberオブジェクトにプロトタイプを追加します。

サンプルコード [実行]

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>Sample</title>
</head>
<body>
<script type="text/javascript"><!--
n = new Number(2.15);
Number.prototype.birthday = "My Brithday";
document.write(n.birthday);
// --></script>
</body>
</html>