This internal operator converts its argument to an appropriate numeric value.
The ToNumber operator converts its input values according to the following table:
|Boolean||1 if true, 0 if false.|
|Number||No conversion, the input value is returned unchanged.|
|String||The value of a sequence of characters that can reasonably be converted to a number, and if not then NaN is returned.|
|Object||Internally, a conversion to one of the primitive types happens followed by a conversion from that type to a number. Some objects will return a number that is readily usable. Others will return something that cannot be converted and NaN will result.|
The string scanning algorithm copes with spelled out special values such as Infinity, exponential values and can scan integers in Octal and Hexadecimal notation as well as decimal.