In JavaScript, you want to limit the value of a number, but you don't need to limit whether it is an integer or a floating point number.
The code copy is as follows:
var num1 = 80;
var num2 = 55.51;
var num3 = -34;
var num4 = 9e5;
document.write(num1 + " " + num2 + " " + num3 + " " + num4);
//Operation result 80 55.51 -34 900000
toExponential() function is displayed by converting numeric values into science and technology, for example:
The code copy is as follows:
document.write(num2.toExponential(9));//Output 5.551000000e+1
Turn down w3cschool value object properties and object methods
Number object properties
Attribute description
The constructor returns a reference to the Number function that created this object.
The largest number that MAX_VALUE can represent.
The smallest number that MIN_VALUE can represent.
NaN is not a digital value.
NEGATIVE_INFINITY is negative infinity, and returns this value when overflowing.
POSITIVE_INFINITY is infinity and returns this value when overflowing.
prototype gives you the ability to add properties and methods to objects.
Number object method
Method Description
toString converts numbers into strings, using the specified cardinality.
toLocaleString converts numbers into strings, using local numeric format order.
toFixed converts numbers into strings, and the result has a number of numbers with specified digits after the decimal point.
toExponential converts the value of the object into exponential counting method.
toPrecision formats the numbers to the specified length.
valueOf returns the basic numeric value of a Number object.
The above is all about the values in JavaScript data types. I hope you like it.