Contents

toNumber()

Converts the JavaScript value to a Nsnumber object.

Declaration

func toNumber() -> NSNumber!

Return Value

A NSNumber object encapsulating the native representation of the value.

Discussion

If the value represents a Boolean value, the resulting NSNumber object is created as with the numberWithBool: method. Otherwise, this method uses JavaScript type coercion to convert the value to a JavaScript numeric value and creates a NSNumber object wrapping the result.

See Also

Reading and Converting JavaScript Values