---
title: toBool()
framework: javascriptcore
role: symbol
role_heading: Instance Method
path: javascriptcore/jsvalue/tobool()
---

# toBool()

Converts the JavaScript value to a native Boolean value.

## Declaration

```swift
func toBool() -> Bool
```

## Return Value

Return Value The native Boolean value.

## Discussion

Discussion This method uses JavaScript type coercion to convert the value to a JavaScript Boolean value, then returns the native representation of the result. Thus, this method can return true even when the isBoolean property does not.

## See Also

### Reading and Converting JavaScript Values

- [toObject()](javascriptcore/jsvalue/toobject().md)
- [toObjectOf(_:)](javascriptcore/jsvalue/toobjectof(_:).md)
- [toDouble()](javascriptcore/jsvalue/todouble().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)
