Name
Number: support for numbers — ECMAScript v1: Object → Number
Constructor
new Number(value) Number(value)
Arguments
-
value The numeric value of the Number object being created or a value to be converted to a number.
Returns
When Number( ) is used
with the new operator as a
constructor, it returns a newly constructed Number object. When
Number( ) is invoked as a
function without the new
operator, it converts its argument to a primitive numeric value
and returns that value (or NaN
if the conversion failed).
Constants
-
Number.MAX_VALUE The largest representable number.
-
Number.MIN_VALUE The smallest representable number.
-
Number.NaN Not-a-number value.
-
Number.NEGATIVE_INFINITY Negative infinite value; returned on overflow.
-
Number.POSITIVE_INFINITY Infinite value; returned on overflow.
Methods
-
toString( ) Converts a number to a string using a specified radix (base).
-
toLocaleString( ) Converts a number to a string using local number-formatting conventions.
-
toFixed( ) Converts a number to a string that contains a specified number of digits after the decimal place.
-
toExponential( ) Converts a number to a string using exponential notation with the specified number of digits after the decimal place.
-
toPrecision( ) Converts a number to a string using the specified number of significant digits. Uses exponential or fixed-point notation depending on the size of the number and the number of significant digits specified.
-
valueOf( ) Returns the primitive numeric value of a Number object.
Description
Numbers ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access