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

# JSObjectCallAsConstructor(_:_:_:_:_:)

Calls an object as a constructor.

```
func JSObjectCallAsConstructor(_ ctx: JSContextRef!, _ object: JSObjectRef!, _ argumentCount: Int, _ arguments: UnsafePointer<JSValueRef?>!, _ exception: UnsafeMutablePointer<JSValueRef?>!) -> JSObjectRef!
```

## Parameters

`ctx`

The execution context to use.

`object`

The [`JSObjectRef`](/documentation/JavaScriptCore/JSObjectRef) to call as a constructor.

`argumentCount`

An integer count of the number of arguments in `arguments`.

`arguments`

A [`JSValueRef`](/documentation/JavaScriptCore/JSValueRef) array of arguments to pass to the constructor. Pass `NULL` if `argumentCount` is `0`.

`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 [`JSObjectRef`](/documentation/JavaScriptCore/JSObjectRef) that results from calling `object` as a constructor, or `NULL` if the system throws an exception or `object` isn’t a constructor.

---

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)