var var_name = new Number(value)
- NaN: This property has Equal to a value that is not a number.
- NEGATIVE_INFINITY: This has a value that is less than MIN_VALUE.
- POSITIVE_INFINITY: This has a value that is greater than MAX_VALUE.
- prototype: This property is used to assign new properties and methods to the Number object.
- constructor: This property will return the function that created this object’s instance
Number Properties in TypeScript: Maximum value of a number variable has: 1.7976931348623157e+308 The least value of a number variable has: 5e-324 Value of Negative Infinity: -Infinity Value of Negative Infinity:Infinity
Example of NaN:
Month is NaN
- toExponential(): This method will return a number to display in exponential notation.
- toFixed(): This method will stable the number to the right of the decimal with a specific number of digits.
- toLocaleString(): This method is used to convert the number into a local specific representation of the number.
- toPrecision(): It will define total digits to the left and right of the decimal to display of a number. It will also show an error when there is negative precision.
- toString(): Used to return the string representation of the number in the specified base.
- valueOf(): This method will return number’s primitive value.
// The toFixed()
num3 = 237.134
"num3.toFixed() is "
"num3.toFixed(2) is "
"num3.toFixed(6) is "
num3.toFixed() is 237 num3.toFixed(2) is 237.134 num3.toFixed(6) is 237.13400
5.7645326 5 5.7
10 1010 12