JavaScript DHTML/Object Oriented/prototype

Материал из Web эксперт
Перейти к: навигация, поиск

Add description property to Number objects

   <source lang="html4strict">
 

<html> <head>

 <script type="text/javascript">
    
   Number.prototype.description = null;
   slHighway = new Number(65);
   slHighway.description = "Interstate Highway Speed Limit";
   function tellDifference(num1) {
     document.write(num1.description);
   }
 </script>

</head> <body>

 <script type="text/javascript">
   tellDifference(slHighway);
 </script>

</body> </html>


 </source>