<!--
{
  "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/JSObjectRef",
  "metadataVersion" : "0.1.0",
  "role" : "Type Alias",
  "symbol" : {
    "kind" : "Type Alias",
    "modules" : [
      "JavaScriptCore"
    ],
    "preciseIdentifier" : "c:@T@JSObjectRef"
  },
  "title" : "JSObjectRef"
}
-->

# JSObjectRef

A JavaScript object.

```
typealias JSObjectRef = OpaquePointer
```

## Discussion

A [`JSObjectRef`](/documentation/JavaScriptCore/JSObjectRef) is a [`JSValueRef`](/documentation/JavaScriptCore/JSValueRef).

## Topics

### Accessing the Global Object

[`JSContextGetGlobalObject(_:)`](/documentation/JavaScriptCore/JSContextGetGlobalObject(_:))

Gets the global object of a JavaScript execution context.

### Working with Objects

[`JSObjectCallAsConstructor(_:_:_:_:_:)`](/documentation/JavaScriptCore/JSObjectCallAsConstructor(_:_:_:_:_:))

Calls an object as a constructor.

[`JSObjectCallAsFunction(_:_:_:_:_:_:)`](/documentation/JavaScriptCore/JSObjectCallAsFunction(_:_:_:_:_:_:))

Calls an object as a function.

[`JSObjectCopyPropertyNames(_:_:)`](/documentation/JavaScriptCore/JSObjectCopyPropertyNames(_:_:))

Gets the names of an object’s enumerable properties.

[`JSObjectDeleteProperty(_:_:_:_:)`](/documentation/JavaScriptCore/JSObjectDeleteProperty(_:_:_:_:))

Deletes a property from an object.

[`JSObjectGetPrivate(_:)`](/documentation/JavaScriptCore/JSObjectGetPrivate(_:))

Gets an object’s private data.

[`JSObjectGetProperty(_:_:_:_:)`](/documentation/JavaScriptCore/JSObjectGetProperty(_:_:_:_:))

Gets a property from an object.

[`JSObjectGetPropertyAtIndex(_:_:_:_:)`](/documentation/JavaScriptCore/JSObjectGetPropertyAtIndex(_:_:_:_:))

Gets a property from an object by numeric index.

[`JSObjectGetPrototype(_:_:)`](/documentation/JavaScriptCore/JSObjectGetPrototype(_:_:))

Gets an object’s prototype.

[`JSObjectHasProperty(_:_:_:)`](/documentation/JavaScriptCore/JSObjectHasProperty(_:_:_:))

Tests whether an object has a specified property.

[`JSObjectIsConstructor(_:_:)`](/documentation/JavaScriptCore/JSObjectIsConstructor(_:_:))

Tests whether you can call an object as a constructor.

[`JSObjectIsFunction(_:_:)`](/documentation/JavaScriptCore/JSObjectIsFunction(_:_:))

Tests whether you can call an object as a function.

[`JSObjectMake(_:_:_:)`](/documentation/JavaScriptCore/JSObjectMake(_:_:_:))

Creates a JavaScript object.

[`JSObjectMakeArray(_:_:_:_:)`](/documentation/JavaScriptCore/JSObjectMakeArray(_:_:_:_:))

Creates a JavaScript array object.

[`JSObjectMakeConstructor(_:_:_:)`](/documentation/JavaScriptCore/JSObjectMakeConstructor(_:_:_:))

Creates a JavaScript constructor.

[`JSObjectMakeDate(_:_:_:_:)`](/documentation/JavaScriptCore/JSObjectMakeDate(_:_:_:_:))

Creates a JavaScript date object as though invoking the built-in date constructor.

[`JSObjectMakeError(_:_:_:_:)`](/documentation/JavaScriptCore/JSObjectMakeError(_:_:_:_:))

Creates a JavaScript error object as though invoking the built-in error constructor.

[`JSObjectMakeFunction(_:_:_:_:_:_:_:_:)`](/documentation/JavaScriptCore/JSObjectMakeFunction(_:_:_:_:_:_:_:_:))

Creates a function with a specified script as its body.

[`JSObjectMakeFunctionWithCallback(_:_:_:)`](/documentation/JavaScriptCore/JSObjectMakeFunctionWithCallback(_:_:_:))

Creates a JavaScript function with a specified callback as its implementation.

[`JSObjectMakeRegExp(_:_:_:_:)`](/documentation/JavaScriptCore/JSObjectMakeRegExp(_:_:_:_:))

Creates a JavaScript regular expression object as though invoking the built-in regular expression constructor.

[`JSObjectSetPrivate(_:_:)`](/documentation/JavaScriptCore/JSObjectSetPrivate(_:_:))

Sets a pointer to private data on an object.

[`JSObjectSetProperty(_:_:_:_:_:_:)`](/documentation/JavaScriptCore/JSObjectSetProperty(_:_:_:_:_:_:))

Sets a property on an object.

[`JSObjectSetPropertyAtIndex(_:_:_:_:_:)`](/documentation/JavaScriptCore/JSObjectSetPropertyAtIndex(_:_:_:_:_:))

Sets a property on an object by numeric index.

[`JSObjectGetPropertyForKey(_:_:_:_:)`](/documentation/JavaScriptCore/JSObjectGetPropertyForKey(_:_:_:_:))

Gets a property from an object using a JavaScript value as the property key.

[`JSObjectSetPrototype(_:_:_:)`](/documentation/JavaScriptCore/JSObjectSetPrototype(_:_:_:))

Sets an object’s prototype.

[`JSObjectDeletePropertyForKey(_:_:_:_:)`](/documentation/JavaScriptCore/JSObjectDeletePropertyForKey(_:_:_:_:))

Deletes a property from an object using a JavaScript value as the property key.

[`JSObjectHasPropertyForKey(_:_:_:_:)`](/documentation/JavaScriptCore/JSObjectHasPropertyForKey(_:_:_:_:))

Tests whether an object has the specified property using a JavaScript value as the property key.

[`JSObjectSetPropertyForKey(_:_:_:_:_:_:)`](/documentation/JavaScriptCore/JSObjectSetPropertyForKey(_:_:_:_:_:_:))

Sets a property on an object using a JavaScript value as the property key.

[`JSObjectMakeDeferredPromise(_:_:_:_:)`](/documentation/JavaScriptCore/JSObjectMakeDeferredPromise(_:_:_:_:))

Creates a JavaScript promise object by invoking the provided executor.

### Working with Classes

[`JSClassCreate(_:)`](/documentation/JavaScriptCore/JSClassCreate(_:))

Creates a JavaScript class.

[`JSClassRelease(_:)`](/documentation/JavaScriptCore/JSClassRelease(_:))

Releases a JavaScript class.

[`JSClassRetain(_:)`](/documentation/JavaScriptCore/JSClassRetain(_:))

Retains a JavaScript class.

[`kJSClassDefinitionEmpty`](/documentation/JavaScriptCore/kJSClassDefinitionEmpty)

A class definition structure of the current version that contains null pointers and has no attributes.

[`JSClassDefinition`](/documentation/JavaScriptCore/JSClassDefinition)

A structure that contains properties and callbacks that define a type of object.

[JSClassAttribute](/documentation/JavaScriptCore/JSClassAttribute)

A JavaScript class attribute.

### Working with Properties

[`JSPropertyNameAccumulatorAddName(_:_:)`](/documentation/JavaScriptCore/JSPropertyNameAccumulatorAddName(_:_:))

Adds a property name to a JavaScript property name accumulator.

[`JSPropertyNameArrayGetCount(_:)`](/documentation/JavaScriptCore/JSPropertyNameArrayGetCount(_:))

Gets a count of the number of items in a JavaScript property name array.

[`JSPropertyNameArrayGetNameAtIndex(_:_:)`](/documentation/JavaScriptCore/JSPropertyNameArrayGetNameAtIndex(_:_:))

Gets a property name at a specified index in a JavaScript property name array.

[`JSPropertyNameArrayRelease(_:)`](/documentation/JavaScriptCore/JSPropertyNameArrayRelease(_:))

Releases a JavaScript property name array.

[`JSPropertyNameArrayRetain(_:)`](/documentation/JavaScriptCore/JSPropertyNameArrayRetain(_:))

Retains a JavaScript property name array.

[`JSPropertyAttributes`](/documentation/JavaScriptCore/JSPropertyAttributes)

A set of JavaScript property attributes.

[JSPropertyAttribute](/documentation/JavaScriptCore/JSPropertyAttribute)

A JavaScript property attribute.

[`JSPropertyNameArrayRef`](/documentation/JavaScriptCore/JSPropertyNameArrayRef)

An array of JavaScript property names.

[`JSPropertyNameAccumulatorRef`](/documentation/JavaScriptCore/JSPropertyNameAccumulatorRef)

An ordered set of the names of a JavaScript object’s properties.

### Creating a Typed Array

[`JSObjectMakeTypedArray(_:_:_:_:)`](/documentation/JavaScriptCore/JSObjectMakeTypedArray(_:_:_:_:))

Creates a JavaScript typed array object with the specified number of elements.

[`JSObjectMakeTypedArrayWithBytesNoCopy(_:_:_:_:_:_:_:)`](/documentation/JavaScriptCore/JSObjectMakeTypedArrayWithBytesNoCopy(_:_:_:_:_:_:_:))

Creates a JavaScript typed array object from an existing pointer.

[`JSObjectMakeTypedArrayWithArrayBuffer(_:_:_:_:)`](/documentation/JavaScriptCore/JSObjectMakeTypedArrayWithArrayBuffer(_:_:_:_:))

Creates a JavaScript typed array object from an existing JavaScript array buffer object.

[`JSObjectMakeTypedArrayWithArrayBufferAndOffset(_:_:_:_:_:_:)`](/documentation/JavaScriptCore/JSObjectMakeTypedArrayWithArrayBufferAndOffset(_:_:_:_:_:_:))

Creates a JavaScript typed array object from an existing JavaScript array buffer object with the specified offset and length.

[`JSTypedArrayType`](/documentation/JavaScriptCore/JSTypedArrayType)

The type of a JavaScript typed array object.

[`JSTypedArrayBytesDeallocator`](/documentation/JavaScriptCore/JSTypedArrayBytesDeallocator)

A function that deallocates bytes that pass to a typed array constructor.

### Accessing Typed Array Information

[`JSObjectGetTypedArrayBytesPtr(_:_:_:)`](/documentation/JavaScriptCore/JSObjectGetTypedArrayBytesPtr(_:_:_:))

Returns a temporary pointer to the backing store of a JavaScript typed array object.

[`JSObjectGetTypedArrayLength(_:_:_:)`](/documentation/JavaScriptCore/JSObjectGetTypedArrayLength(_:_:_:))

Returns the length of a JavaScript typed array object.

[`JSObjectGetTypedArrayByteLength(_:_:_:)`](/documentation/JavaScriptCore/JSObjectGetTypedArrayByteLength(_:_:_:))

Returns the byte length of a JavaScript typed array object.

[`JSObjectGetTypedArrayByteOffset(_:_:_:)`](/documentation/JavaScriptCore/JSObjectGetTypedArrayByteOffset(_:_:_:))

Returns the byte offset of a JavaScript typed array object.

[`JSObjectGetTypedArrayBuffer(_:_:_:)`](/documentation/JavaScriptCore/JSObjectGetTypedArrayBuffer(_:_:_:))

Returns the JavaScript array buffer object to use as the backing of a JavaScript typed array object.

### Working with Array Buffers

[`JSObjectMakeArrayBufferWithBytesNoCopy(_:_:_:_:_:_:)`](/documentation/JavaScriptCore/JSObjectMakeArrayBufferWithBytesNoCopy(_:_:_:_:_:_:))

Creates a JavaScript array buffer object from an existing pointer.

[`JSObjectGetArrayBufferByteLength(_:_:_:)`](/documentation/JavaScriptCore/JSObjectGetArrayBufferByteLength(_:_:_:))

Returns the number of bytes in a JavaScript data object.

[`JSObjectGetArrayBufferBytesPtr(_:_:_:)`](/documentation/JavaScriptCore/JSObjectGetArrayBufferBytesPtr(_:_:_:))

Returns a pointer to the data buffer that serves as the backing store for a JavaScript typed array object.



---

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)