---
title: "setValue(_:at:)"
framework: javascriptcore
role: symbol
role_heading: Instance Method
path: "javascriptcore/jsvalue/setvalue(_:at:)"
---

# setValue(_:at:)

Sets the value at the specified numeric index in the JavaScript object value.

## Declaration

```swift
func setValue(_ value: Any!, at index: Int)
```

## Parameters

- `value`: The value to set at the specified index.
- `index`: An index in the JavaScript object.

## Discussion

Discussion Calling this method is equivalent to using the subscript operator with a numeric subscript in JavaScript. Use it to access elements of JavaScript arrays or of objects with numerically-indexed properties.

## Topics

### Related Documentation

- [setObject(_:atIndexedSubscript:)](javascriptcore/jsvalue/setobject(_:atindexedsubscript:).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)
- [forProperty(_:)](javascriptcore/jsvalue/forproperty(_:).md)
- [setValue(_:forProperty:)](javascriptcore/jsvalue/setvalue(_:forproperty:).md)
- [JSValueProperty](javascriptcore/jsvalueproperty.md)
