Add description property to Number objects : prototype « Object Oriented « JavaScript DHTML






Add description property to Number objects

  

<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>

   
    
  








Related examples in the same category