number

W3C Working Draft

number number(object?) : The number function converts its argument to a number as follows: (1) a string that consists of optional whitespace followed by an optional minus sign followed by a Number followed by whitespace is converted to the IEEE 754 (2) number that is nearest to the mathematical value represented by the string; any other string is converted to NaN (3) boolean true is converted to 1; boolean false is converted to 0 (4) a node-set is first converted to a string as if by a call to the string function and then converted in the same way as a string argument (5) an object of a type other than the four basic types is converted to a number in a way that is dependent on that type. If the argument is omitted, it defaults to a node-set with the context node as its only member.