JavaScript: Number.NEGATIVE_INFINITY property
This JavaScript tutorial explains how to use the Number property called NEGATIVE_INFINITY with syntax and examples.
Description
In JavaScript, NEGATIVE_INFINITY is a static property of the Number object that is used to return the value that represents negative infinity (ie: -Infinity). Because NEGATIVE_INFINITY is a property of the Number object, it must be invoked through the object called Number.
Syntax
In JavaScript, the syntax for the NEGATIVE_INFINITY property is:
Number.NEGATIVE_INFINITY;
Parameters or Arguments
There are no parameters or arguments for the NEGATIVE_INFINITY property.
Returns
The NEGATIVE_INFINITY property returns the value that represents negative infinity which is -Infinity.
Note
- The NEGATIVE_INFINITY property is a property of the Number object and not a number function. However, we have included the NEGATIVE_INFINITY property within our JS Number Methods section because you will most likely use this property in conjunction with the Number methods found in this section.
Example
Let's take a look at an example of how to use the NEGATIVE_INFINITY property in JavaScript.
For example:
console.log(Number.NEGATIVE_INFINITY);
In this example, we have invoked the NEGATIVE_INFINITY property using the Number class.
We have written the output of the NEGATIVE_INFINITY property to the web browser console log, for demonstration purposes, to show what the NEGATIVE_INFINITY property returns.
The following will be output to the web browser console log:
-Infinity
In this example, the NEGATIVE_INFINITY property returned a value of -Infinity which represents negative infinity in JavaScript.
Advertisements