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

# JSContextGetGlobalObject(_:)

Gets the global object of a JavaScript execution context.

```
func JSContextGetGlobalObject(_ ctx: JSContextRef!) -> JSObjectRef!
```

## Parameters

`ctx`

The [`JSContextRef`](/documentation/JavaScriptCore/JSContextRef) with the global object you want to get.

## Return Value

The global object of `ctx`.

## Discussion

---

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)