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

# JSObjectCallAsFunction(_:_:_:_:_:_:)

Calls an object as a function.

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

## Parameters

`ctx`

The execution context to use.

`object`

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

`thisObject`

The object to use as `this`, or `NULL` to use the global object as `this`.

`argumentCount`

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

`arguments`

A [`JSValueRef`](/documentation/JavaScriptCore/JSValueRef) array of arguments to pass to the function. 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 [`JSValueRef`](/documentation/JavaScriptCore/JSValueRef) that results from calling `object` as a function, or `NULL` if the system throws an exception or `object` isn’t a function.

---

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)