---
title: toDouble()
framework: javascriptcore
role: symbol
role_heading: Instance Method
path: javascriptcore/jsvalue/todouble()
---

# toDouble()

Converts the JavaScript value to a native floating-point value.

## Declaration

```swift
func toDouble() -> Double
```

## Return Value

Return Value The native double-precision floating-point value.

## Discussion

Discussion This method uses JavaScript type coercion to convert the value to a JavaScript numeric value, then returns a native representation of the result. In JavaScript, all numeric values are treated as double-precision floating-point numbers except for certain operations such as bit shifts.

## See Also

### Reading and Converting JavaScript Values

- [toObject()](javascriptcore/jsvalue/toobject().md)
- [toObjectOf(_:)](javascriptcore/jsvalue/toobjectof(_:).md)
- [toBool()](javascriptcore/jsvalue/tobool().md)
- [toInt32()](javascriptcore/jsvalue/toint32().md)
- [toUInt32()](javascriptcore/jsvalue/touint32().md)
- [toNumber()](javascriptcore/jsvalue/tonumber().md)
- [toString()](javascriptcore/jsvalue/tostring().md)
- [toDate()](javascriptcore/jsvalue/todate().md)
- [toArray()](javascriptcore/jsvalue/toarray().md)
- [toDictionary()](javascriptcore/jsvalue/todictionary().md)
- [toPoint()](javascriptcore/jsvalue/topoint().md)
- [toRange()](javascriptcore/jsvalue/torange().md)
- [toRect()](javascriptcore/jsvalue/torect().md)
- [toSize()](javascriptcore/jsvalue/tosize().md)
