---
title: toString()
framework: javascriptcore
role: symbol
role_heading: Instance Method
path: javascriptcore/jsvalue/tostring()
---

# toString()

Converts the JavaScript value to a native string.

## Declaration

```swift
func toString() -> String!
```

## Return Value

Return Value The string representation of the value.

## Discussion

Discussion This method uses JavaScript type coercion rules to convert the value to a JavaScript string, then creates a native string from the result. Thus, this method can return a string even when the isString property is false; for example, an empty object becomes the string "[object Object]".

## See Also

### Reading and Converting JavaScript Values

- [toObject()](javascriptcore/jsvalue/toobject().md)
- [toObjectOf(_:)](javascriptcore/jsvalue/toobjectof(_:).md)
- [toBool()](javascriptcore/jsvalue/tobool().md)
- [toDouble()](javascriptcore/jsvalue/todouble().md)
- [toInt32()](javascriptcore/jsvalue/toint32().md)
- [toUInt32()](javascriptcore/jsvalue/touint32().md)
- [toNumber()](javascriptcore/jsvalue/tonumber().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)
