Number.prototype : prototype : Number Data Type JAVASCRIPT TUTORIALS


JAVASCRIPT TUTORIALS » Number Data Type » prototype »

 

Number.prototype









Syntax








Number.prototype.property
    Number.prototype.method



The prototype property allows you to add properties or methods to all instances of this class.












<html>
    <body>
    <script language="JavaScript">
    <!--
    var myProp = new Number();
    function triple(num){
        var result;
        result = (num * 3);
        return result;
    }
    Number.prototype.calc3 = triple;
    document.write("Example demonstrates the prototype property for the number object.""<br><br>");
    document.write("150 tripled is: " + myProp.calc3(150"<br>");
    -->
    </script>
    </body>
    </html>







HTML code for linking to this page:

Follow Navioo On Twitter

JAVASCRIPT TUTORIALS

 Navioo Number Data Type
» prototype