<!--
{
  "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/JSObjectMake(_:_:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "JavaScriptCore"
    ],
    "preciseIdentifier" : "c:@F@JSObjectMake"
  },
  "title" : "JSObjectMake(_:_:_:)"
}
-->

# JSObjectMake(_:_:_:)

Creates a JavaScript object.

```
func JSObjectMake(_ ctx: JSContextRef!, _ jsClass: JSClassRef!, _ data: UnsafeMutableRawPointer!) -> JSObjectRef!
```

## Parameters

`ctx`

The execution context to use.

`jsClass`

The [`JSClassRef`](/documentation/JavaScriptCore/JSClassRef) to assign to the object. Pass `NULL` to use the default object class.

`data`

A pointer to set as the object’s private data. Pass `NULL` to specify no private data.

## Return Value

A [`JSObjectRef`](/documentation/JavaScriptCore/JSObjectRef) with the specified class and private data.

## Discussion

The default object class doesn’t allocate storage for private data, so you must provide a non-`NULL` `jsClass` to [`JSObjectMake(_:_:_:)`](/documentation/JavaScriptCore/JSObjectMake(_:_:_:)) if you want your object to be able to store private data.

The system sets `data` on the created object before calling the initialize methods in its class chain. This enables the initialize methods to retrieve and manipulate data through [`JSObjectGetPrivate(_:)`](/documentation/JavaScriptCore/JSObjectGetPrivate(_:)).

---

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)