Number object
Number is a built-in object in JavaScript for numerical constants as such maximum, minimum, infinity, -infinity and not-a-number values. We can use these values as follows:
const biggestNum = Number.MAX_VALUE;
const smallestNum = Number.MIN_VALUE;
const infiniteNum = Number.POSITIVE_INFINITY;
const negInfiniteNum = Number.NEGATIVE_INFINITY;
const notANum = Number.NaN;
Some of the available methods in the Number object are shown in the table below:
| Returns a floating point number. Also available in the global scope. |
| Returns an integer of the specified radix or base. Also available in the global scope. |
| Determines whether the passed value is a finite number. |
| Determines whether the passed value is |
| Returns a string representing the number in exponential notation. |
| Returns a string representing the number in floating-point notation with the specified number of digits after decimal. |
| Returns the string representation of the number in the specified radix or base. |
| Returns a string with a language-sensitive representation of this number. |
Some other things to remember.
Addition, subtraction, division, and multiplication with any number result in Infinity. However, division and subtraction of Infinity with Infinity yields NaN.
Null is considered as 0 in arithmetic operations, so it won't give an error but perform the operation considering the value as 0.
delete operator can be used to delete non-var declared variables, but it fails to delete the ones declared with the var keyword. Hence, we can delete the properties of the object but not the object declared in the global scope for example.