Thursday, April 4, 2013

Javascript function on Number Object


The Number object is an object wrapper for primitive numeric values.

Syntax for creating a Number object: var myNum=new Number(number);

Number Object Properties
Constructor Returns a reference to the Number function that created the object
MAX_VALUE Returns the largest possible value in JavaScript
MIN_VALUE Returns the smallest possible value in JavaScript
NaN Represents "Not-a-number" value
NEGATIVE_INFINITY Represents a value that is less than MIN_VALUE
POSITIVE_INFINITY Represents a value that is greater than MAX_VALUE
Prototype Allows you to add properties and methods to the object

Number Object Methods
toExponential() Converts the value of the object into an exponential notation
toFixed() Formats a number to the specified number of decimals
toLocaleString()
toPrecision() Converts a number into a number with a specified number of digits
toString() Converts the Number object into a string
valueOf() Returns the value of the Number object

No comments:

Post a Comment