JavaScript based Number object

grammar

var num = new Number(value);

Number object properties

Attributes description
constructor Returns a reference to the Number function that created this object
MAX_VALUE The largest number that can be represented
MIN_VALUE Representable minimum number
NEGATIVE_INFINITY Negative infinity, return this value when overflow
NaN Non-numeric value (NaN will be returned if a parameter value cannot be converted to a number)
POSITIVE_INFINITY Positive infinity, return this value when overflow
prototype Allows you to have the ability to add properties and methods to objects

Number object methods

method 描述
toExponential(x) Convert the value of an object to exponential notation
toFixed(x) Convert the number to a string with a specified number of digits after the decimal point
toPrecision(x) Format the number to the specified length
toString() Convert numbers to strings, using specified radix
valueOf() Returns the basic numeric value of a Number object
Published 89 original articles · Liked 83 · Visits 3509

Guess you like

Origin blog.csdn.net/devin_xin/article/details/105256286