---
title: "forProperty(_:)"
framework: javascriptcore
role: symbol
role_heading: Instance Method
path: "javascriptcore/jsvalue/forproperty(_:)"
---

# forProperty(_:)

Returns the value of the named property in the JavaScript object value.

## Declaration

```swift
func forProperty(_ property: Any!) -> JSValue!
```

```swift
func forProperty(_ property: String!) -> JSValue!
```

## Parameters

- `property`: The name of a property in the JavaScript object.

## Return Value

Return Value The value of the named property, or the JavaScript undefined value if no property exists by that name.

## Discussion

Discussion Calling this method is equivalent to using the subscript operator with a string subscript in JavaScript. Use it to access fields or properties in JavaScript objects.

## Topics

### Related Documentation

- [objectForKeyedSubscript(_:)](javascriptcore/jsvalue/objectforkeyedsubscript(_:).md)

## See Also

### Working with Container Values

- [defineProperty(_:descriptor:)](javascriptcore/jsvalue/defineproperty(_:descriptor:).md)
- [hasProperty(_:)](javascriptcore/jsvalue/hasproperty(_:).md)
- [deleteProperty(_:)](javascriptcore/jsvalue/deleteproperty(_:).md)
- [atIndex(_:)](javascriptcore/jsvalue/atindex(_:).md)
- [setValue(_:at:)](javascriptcore/jsvalue/setvalue(_:at:).md)
- [setValue(_:forProperty:)](javascriptcore/jsvalue/setvalue(_:forproperty:).md)
- [JSValueProperty](javascriptcore/jsvalueproperty.md)
