Number() Object : Introdunction : Number Data Type JAVASCRIPT TUTORIALS


JAVASCRIPT TUTORIALS » Number Data Type » Introdunction »

 

Number() Object













Syntax








var variable = new Number(value)



The Number object represents numeric value types.

You can create a Number object by specifying a value in the parameter for the number constructor.

Properties and Methods of the Number Object











































Property/Method Description
MAX_VALUE Specifies the largest value a number can have.
MIN_VALUE Specifies the smallest value a number can have without being equal to 0.
NaN Stands for Not a Number. Represents a value that is not equal to any numeric value.
NEGATIVE_INFINITY A special value that represents a negative infinity value.
POSITIVE_INFINITY A special value that represents a positive infinity value.
prototype Represents the prototype for the number class.
toSource() Returns a string representation of the number object.
toString() Returns a string representing the specified number object.
valueOf() Returns the primitive value of a number object as a number data type.




The following example create a number object by calling the Number Constructor.












<html>
    <body>
    <script language="JavaScript">
    <!--
    // Creates a new number object
    var aNum = new Number(3);

    -->
    </script>
    </body>
    </html>







HTML code for linking to this page:

Follow Navioo On Twitter

JAVASCRIPT TUTORIALS

 Navioo Number Data Type
» Introdunction