Skip to content
Related Articles
Open in App
Not now

Related Articles

JavaScript Number Static Properties

Improve Article
Save Article
Like Article
  • Difficulty Level : Medium
  • Last Updated : 10 Feb, 2023
Improve Article
Save Article
Like Article

The JavaScript Number is an object that can represent numeric values like integer, float, hexadecimal, decimal, etc. It acts as a wrapper object for primitive numeric values. It has various methods and properties that are used to perform different tasks on numbers. The following table shows some static properties of the Number object that can be used throughout a program as constants.

Property:

  • MAX_VALUE: It returns the maximum number value that is supported in JavaScript.
  • MIN_VALUE: It returns the smallest positive numeric value that is closest to 0, but, not the most negative number.
  • NEGATIVE_INFINITY: It represents the negative infinity value.
  • POSITIVE_INFINITY: It represents the positive infinity value.
  • MIN_SAFE_INTEGER: It represents the minimum safe integer in JavaScript.
  • NaN: It is used for representing a value that is not a legal number.

The below examples demonstrate how these properties of the Number are used.

Example 1: In this example, we find out the maximum and minimum values supported in JavaScript.

Javascript




console.log('Maximum Value:',
            Number.MAX_VALUE);
console.log('Minimum Value:',
            Number.MIN_VALUE);


Console Output:

Maximum Value: 1.7976931348623157e+308
Minimum Value: 5e-324

Example 2: In this example, we find out the positive and negative infinity values in JavaScript.

Javascript




console.log('Negative Infinity:',
            Number.NEGATIVE_INFINITY);
console.log('Positive Infinity:',
            Number.POSITIVE_INFINITY);


Console Output:

Negative Infinity: -Infinity
Positive Infinity: Infinity

We have a Cheat Sheet on Javascript Numbers where we covered all the important topics of Javascript to check those please go through JavaScript Number Complete Reference.

My Personal Notes arrow_drop_up
Like Article
Save Article
Related Articles

Start Your Coding Journey Now!