<!--
{
  "availability" : [
    "iOS: 7.0.0 -",
    "iPadOS: 7.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.9.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "JavaScriptCore",
  "identifier" : "/documentation/JavaScriptCore/JSValue/toDouble()",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "JavaScriptCore"
    ],
    "preciseIdentifier" : "c:objc(cs)JSValue(im)toDouble"
  },
  "title" : "toDouble()"
}
-->

# toDouble()

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

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

## Return Value

The native double-precision floating-point value.

## 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.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)