Converts the specified object to Number according to the rules:
obj
is already a Number object
(an instance of java.lang.Number
),
the function works simply as a type cast operator,
same as it would be in Java: (Number) obj
obj
is a Boolean object
(i.e. an instance of java.lang.Boolean
),
the function returns the same values as the
expression: obj.toBoolean() ? 1 : 0
obj
is not null
, the function tries to parse the
string returned by obj.toString()
call as integer, fixed-point or
floating-point decimal number value.
obj
parameter is null
, the function returns 0
.
You may call this function in a more method-like style:
obj.toNumber()