<!--
{
  "availability" : [
    "iOS: 16.0.0 -",
    "iPadOS: 16.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.5.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "JavaScriptCore",
  "identifier" : "/documentation/JavaScriptCore/JSObjectGetPropertyAtIndex(_:_:_:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "JavaScriptCore"
    ],
    "preciseIdentifier" : "c:@F@JSObjectGetPropertyAtIndex"
  },
  "title" : "JSObjectGetPropertyAtIndex(_:_:_:_:)"
}
-->

# JSObjectGetPropertyAtIndex(_:_:_:_:)

Gets a property from an object by numeric index.

```
func JSObjectGetPropertyAtIndex(_ ctx: JSContextRef!, _ object: JSObjectRef!, _ propertyIndex: UInt32, _ exception: UnsafeMutablePointer<JSValueRef?>!) -> JSValueRef!
```

## Parameters

`ctx`

The execution context to use.

`object`

The [`JSObjectRef`](/documentation/JavaScriptCore/JSObjectRef) with the property you want to get.

`propertyIndex`

An integer value that is the property’s name.

`exception`

A pointer to a [`JSValueRef`](/documentation/JavaScriptCore/JSValueRef) to store an exception in, if any. Pass `NULL` to discard any exception.

## Return Value

The property’s value, if `object` has the property; otherwise, the undefined value.

## Discussion

Calling [`JSObjectGetPropertyAtIndex(_:_:_:_:)`](/documentation/JavaScriptCore/JSObjectGetPropertyAtIndex(_:_:_:_:)) is equivalent to calling [`JSObjectGetProperty(_:_:_:_:)`](/documentation/JavaScriptCore/JSObjectGetProperty(_:_:_:_:)) with a string that contains `propertyIndex`, but [`JSObjectGetPropertyAtIndex(_:_:_:_:)`](/documentation/JavaScriptCore/JSObjectGetPropertyAtIndex(_:_:_:_:)) provides optimized access to numeric properties.

---

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)