Loading, please wait...

Methods and Properties

JavaScript Number Properties

It includes a list of properties that are associated with the number type values and objects.

 

Table contains a list of Number properties

 

Property

Description

MAX_VALUE

Returns maximum possible value.

MIN_VALUE

Returns minimum possible value.

NEGATIVE_INFINITY

Returns negative infinity(value less than MIN_VALUE)

NaN

Represents a value that is not a number.

POSITIVE_INFINITY

Returns positive infinity(value greater than MAX_VALUE)

 

 

The MAX_VALUE Property

This property returns the maximum possible value which is supported in javascript.

 

Code:

<html> 
<head> 
</head> 
<body>
<h3> JavaScript Number Property </h3>
<h4> The MAX_VALUE property returns largest possible value.</h4>  
<script>
document.write("Largest possible value is "+ Number.MAX_VALUE);
</script>
</body> 
</html> 

 

Output:

 

  

 

The MIN_VALUE Property

This property returns the smallest possible value of a number which is supported in javascript.

 

Code:

<html> 
<head> 
</head> 
<body>
<h3> JavaScript Number Property </h3>
<h4> The MIN_VALUE property returns smallest possible value.</h4>  
<script>
document.write("Smallest possible value is "+ Number.MIN_VALUE);
</script>
</body> 
</html> 

 

Output:

 

 

  

JavaScript Number Methods

The methods are defined as the actions which are used in order to manipulate the number values.

 

The table contains a list of number methods

 

Methods

Description

toString()

Returns number as string

toExponential()

Returns exponential value as a string

toFixed()

Returns a string with a number written to a specified number of decimals.

toPrecision()

Returns a string with a number written to a specified number of digits.

valueOf()

Returns the values of a number