Loading Please Wait...

Logo Lynxsia IT Solutions

JavaScript Number Properties

JS Number Properties

JavaScript provides the following number properties that can be used on all JavaScript numbers:

  • EPSILON The difference between 1 and the smallest number > 1
  • MAX_VALUE The largest number possible in JavaScript
  • MIN_VALUE The smallest number possible in JavaScript
  • MAX_SAFE_INTEGER The maximum safe integer (253 - 1)
  • MIN_SAFE_INTEGER The minimum safe integer -(253 - 1)
  • Number(); Returns a number converted from its argument
  • POSITIVE_INFINITY Infinity (returned on overflow)
  • NEGATIVE_INFINITY Negative infinity (returned on overflow)
  • Nan A "Not-a-Number" value
JavaScript EPSILON

Number.EPSILON is the difference between the smallest floating point number greater than 1 and expressions):

					 
        
          let a = Number.EPSILON; // a = 2.220446049250313e-16
        
      
JavaScript MAX_VALUE

Number.MAX_VALUE is a constant representing the largest possible number in JavaScript.

					 
        
          let a = Number.MAX_VALUE; // a = 1.7976931348623157e+308
        
      
JavaScript MIN_VALUE

Number.MIN_VALUE is a constant representing the lowest possible number in JavaScript.

					 
        
          let a = Number.MIN_VALUE; // a = 5e-324
        
      
JavaScript MAX_SAFE_INTEGER

Number.MAX_SAFE_INTEGER represents the maximum safe integer in JavaScript. Number.MAX_SAFE_INTEGER is (253 - 1).

					 
        
          let a = Number.MAX_SAFE_INTEGER; // a = 9007199254740991
        
      
JavaScript MIN_SAFE_INTEGER

Number.MIN_SAFE_INTEGER represents the minimum safe integer in JavaScript. Number.MIN_SAFE_INTEGER is -(253 - 1).

					 
        
          let a = Number.MIN_SAFE_INTEGER; // a = -9007199254740991
        
      
JavaScript POSITIVE_INFINITY

Number.POSITIVE_INFINITY represents the Infinity. POSITIVE_INFINITY is returned on overflow:

					 
        
          let a = Number.POSITIVE_INFINITY; // a = Infinity
          let b = 1 / 0; // b = Infinity
        
      
JavaScript NEGATIVE_INFINITY

Number.NEGATIVE_INFINITY represents the Negative Infinity. NEGATIVE_INFINITY is returned on overflow:

					 
        
          let a = Number.NEGATIVE_INFINITY; // a = -Infinity
          let b = -1 / 0; // b = -Infinity
        
      
JavaScript NaN - Not a Number

NaN is a JavaScript reserved word for a number that is not a legal number.

					 
        
          let a = Number.NaN; // a = Nan
          let b = 100 / "Apple"; // b = NaN
        
      
Number.EPSILON, MAX_SAFE_INTEGER and MIN_SAFE_INTEGER are ES6 features. They do not work in Internet Explorer.
Number.EPSILON, MAX_SAFE_INTEGER and MIN_SAFE_INTEGER are ES6 features. They do not work in Internet Explorer.
Number properties belong to the JavaScript Number Object. These properties can only be accessed as Number.MAX_VALUE. Using x.MAX_VALUE, where x is a variable or a value, will return undefined
					 
        
          let a = 6;
          let b = a.MAX_VALUE; // b = undefined
        
      

How you feel about this blog:

Share this blog on:

Report Us

If you find any error in the turtorials, or want to share your suggestion/feedback, feel free to send us email at: info@lynxsia.com

Contact Us
Ads
Logo
Lynxsia IT Solutions

We are concern with various development process like website design & development, E-commerce development, Software development, Application development, SMS & Bulk SMS Provider, PWA Development, and many more..

Kotwali Road, Chhiptehri, Banda, 210001, UP, India

Copyright © 2022, Lynxsia IT Solutions, All rights reserved