In JavaScript, the Number object provides several properties that represent numeric values or special numeric values. These properties are accessed directly on the Number object itself. Here are some commonly used number properties in JavaScript:
1. Number.MAX_VALUE
Represents the maximum representable numeric value in JavaScript.
console.log(Number.MAX_VALUE); // Output: 1.7976931348623157e+308
Represents the smallest positive numeric value greater than zero.
console.log(Number.MIN_VALUE); // Output: 5e-324
Represents a special value that indicates Not-a-Number (NaN).
console.log(Number.NaN); // Output: NaN
Represents positive infinity.
console.log(Number.POSITIVE_INFINITY); // Output: Infinity
Represents negative infinity.
console.log(Number.NEGATIVE_INFINITY); // Output: -Infinity
Represents the difference between 1 and the smallest representable greater than 1.
console.log(Number.EPSILON); // Output: 2.220446049250313e-16
Represents the maximum safe integer in JavaScript, which is 2^53 - 1.
console.log(Number.MAX_SAFE_INTEGER); // Output: 9007199254740991
Represents the minimum safe integer in JavaScript, which is -(2^53 - 1).
console.log(Number.MIN_SAFE_INTEGER); // Output: -9007199254740991
These properties are useful for various numerical operations and for checking the range and limits of numeric values in JavaScript.