---
title: globalObject
framework: javascriptcore
role: symbol
role_heading: Instance Property
path: javascriptcore/jscontext/globalobject
---

# globalObject

The JavaScript global object associated with the context.

## Declaration

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

## Discussion

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 object or through the methods listed in the Accessing JavaScript global state with subscripts section in JSContext. note: For JSContext instances originating in WebKit, this method returns a reference to the WindowProxy object.

## See Also

### Working with JavaScript global state

- [exception](javascriptcore/jscontext/exception.md)
- [exceptionHandler](javascriptcore/jscontext/exceptionhandler.md)
- [virtualMachine](javascriptcore/jscontext/virtualmachine.md)
- [name](javascriptcore/jscontext/name.md)
