The Number is a javascript object that represents numerical date, either integers or floating-point numbers.
The syntax for creating a number object is as follows:
var num = new Number(number);
If it receives a non-number argument, then the argument cannot be converted into a number, it returns NaN (Not-a-Number).
Javascript provides few Number Properties . Here is a list of each property and their description:-
MAX_VALUE- It belongs to the static property . The largest possible value a number in JavaScript can have 1.7976931348623157E+308 .
The syntax is:
var val = Number.MAX_VALUE;
MIN_VALUE - The smallest possible value a number in JavaScript can have 5E-324 .
The syntax is:
var val = Number.MIN_VALUE;
NaN- Equal to a value that is not a number.
The syntax is:
var val = Number.NaN;
NEGATIVE_INFINITY - A value that is less than MIN_VALUE. Because NEGATIVE_INFINITY is a constant, it is a read-only property of Number.
The syntax is:
var val = Number. NEGATIVE_INFINITY;
POSITIVE _INFINITY- A value that is greater than MAX_VALUE .
The syntax is:
var val = Number. POSITIVE_INFINITY;
Prototype - A static property of the Number object. This prototype property is used to assign new properties and methods to the Number object in the current document . Prototype is a global property associated with all the objects.
Syntax ix:
object.prototype.name = value;
Constructor - Returns the function that created this object's instance. By default this is the Number object.
Syntax is:
number.constructor()
0 Comment(s)