<!--
{
  "availability" : [
    "iOS: 7.0.0 -",
    "iPadOS: 7.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.9.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "JavaScriptCore",
  "identifier" : "/documentation/JavaScriptCore/JSContext/globalObject",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "JavaScriptCore"
    ],
    "preciseIdentifier" : "c:objc(cs)JSContext(py)globalObject"
  },
  "title" : "globalObject"
}
-->

# globalObject

The JavaScript global object associated with the context.

```
var globalObject: JSValue! { get }
```

## Discussion

In a web browser, the global object of a JavaScript context is the browser window (the `window` object in JavaScript). Outside of web-browser use, a context’s global object serves a similar role, separating the JavaScript namespaces of different contexts. Global variables within a script appear as fields or subscripts in the global object—you can access them either through this [`JSValue`](/documentation/JavaScriptCore/JSValue) object or through the methods listed in the Accessing JavaScript global state with subscripts section in [`JSContext`](/documentation/JavaScriptCore/JSContext).

> Note:
> For ``doc://com.apple.javascriptcore/documentation/JavaScriptCore/JSContext`` instances originating in WebKit, this method returns a reference to the `WindowProxy` 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)