Object Number in JavaScript
The Number object represents the date in the form of a numeric value, or an integer or floating-point number. Generally, you don't need to worry about Number objects because the browser automatically converts number literals to illustrate the number classes.
Syntax
Syntax to create a Number object as follows:
var val = new Number ( number );
In the position of number, if you provide any non-numeric value, then the parameter cannot be converted to a number, it returns NaN (short for Not-a-Number).
The properties of Number
Below is a list of its attributes and descriptions.
Properties DescriptionMAX_VALUE
The maximum possible value of some in JavaScript can be up to 1.7976931348623157E + 308MIN_VALUE
The smallest possible value of some in JavaScript can reach 5E-324NaN
Equivalent to value that is not a numberNEGATIVE_INFINITY
A value less than MIN_VALUEPOSITIVE_INFINITY
A value greater than MAX_VALUEprototype
Static attribute of Number object. Use the prototype property to assign new properties and methods to the Number object in the current documentconstructor
Returns the function that creates the illustration of this object. By default, it is the Number objectThe methods of Number
The Number object contains only the default methods that are part of each object definition.
Method DescriptiontoExponential ()
Make some impressions in exponential form, even if this number is in a range in which JavaScript often uses standard notation.toFixed ()
A number format with a specific number of digits to the right of the decimal part.toLocaleString ()
Returns a string value version of the current number in a format that can be varied according to the browser internal setting.toPrecision ()
Define how many digits (including the digits on the right and left of the decimal part) to display a number.toString ()
Returns the string representation of the numeric value.valueOf ()
Returns the value of the number.According to Tutorialspoint
Previous article: Objects in JavaScript
Next lesson: Boolean object in JavaScript
You should read it
- Summary of JavaScript exercises with sample code
- Browser compatibility in JavaScript
- Syntax of JavaScript
- String object in JavaScript
- Math object in JavaScript
- Boolean objects in JavaScript
- Array (Array) in JavaScript
- What is JavaScript? Can the Internet exist without JavaScript?
- Date object in JavaScript
- For ... loop in JavaScript
- What is Currying in Javascript? How to use Currying in JavaScript
- Things to know about 'this' in JavaScript
Maybe you are interested
How to use the Round function in Excel to round numbers and process data
The Constant Pi (π): History of the Discovery and Application in Mathematics of the Mysterious Number Pi
How to generate random numbers in Excel
Instructions for converting numbers to words in Excel
How to calculate the number of days between two time points extremely quickly using Excel
Fix the error of not being able to hide phone numbers on Telegram