contents   index   previous   next



global.ToNumber()

syntax:

ToNumber(value)

where:

value - to be cast as a number.

 

return:

number - conversion of value.

 

description:

The following table lists how different data types are converted by this function.

 

Boolean
+0, if value is false, else 1

Buffer
same as for String

null
+0

Number
same as value

Object
first, call ToPrimitive(), then call ToNumber() and return result

String
number, if successful, else NaN

undefined
NaN

see:

global.ToInteger(), global.ToInt32()

 

 


global.ToObject()