

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What is negative infinity in javascript?
The Number.NEGATIVE_INFINITY property represents the negative Infinity value. Any value that goes over the maximum value is available in JavaScript gets changed to negative infinity.
Example
function checkInfinity(smallNumber) { if (smallNumber === Number.NEGATIVE_INFINITY) { return 'Process number as -Infinity'; } return smallNumber; } console.log(checkInfinity(-Number.MAX_VALUE)); console.log(checkInfinity(-Number.MAX_VALUE * 2));
Output
-1.7976931348623157e+308 "Process number as -Infinity"
You can find more details about how this number is processed in javascript at MDN docs:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/NEGATIVE_INFINITY
Note − The value of Number.NEGATIVE_INFINITY is the same as the negative value of the global object's Infinity property.
- Related Questions & Answers
- How to print positive and negative infinity values in JavaScript?
- What is infinity?
- JavaScript Infinity Property
- Test element-wise for positive or negative infinity in Numpy
- Test array values for positive or negative infinity in Numpy
- How Is Infinity converted to Boolean in JavaScript?
- How Is Infinity converted to String in JavaScript?
- How Is Infinity converted to Number in JavaScript?
- How -Infinity is converted to Number in JavaScript?
- How -Infinity is converted to String in JavaScript?
- How -Infinity is converted to Boolean in JavaScript?
- How to find the value closest to negative infinity in Python?
- Replace NaN with zero and fill negative infinity values in Python
- Return the negative infinity Norm of the matrix in Linear Algebra in Python
- Is their a negative lookbehind equivalent in JavaScript?
Advertisements