The Number() constructor is used to manufacture a new instance of the built-in Number object converting the input value to a number as it instantiates the new object.
The value of the Number object when the constructor is called in a new expression is the same as value yielded by the type conversion function call.
Refer to the Number() Function topic for a table of rules for converting non-number values to Number objects.
The result is a Number object whose value is equivalent to the that of the passed-in argument. If the value is omitted, the Number object will assume a value of 0.
Note that unlike the Object() constructor, which can be called without its parentheses, calling the Number() constructor without them yields an uninitialized object.
ECMA 262 edition 2 - section - 15.1.3.6
ECMA 262 edition 2 - section - 15.7.1
ECMA 262 edition 2 - section - 15.7.3.1
ECMA 262 edition 3 - section - 15.7.2
Prev | Home | Next |
Number object | Up | Number() |
JavaScript Programmer's Reference, Cliff Wootton Wrox Press (www.wrox.com) Join the Wrox JavaScript forum at p2p.wrox.com Please report problems to support@wrox.com © 2001 Wrox Press. All Rights Reserved. Terms and conditions. |