---
title: "JSGlobalContextCreate(_:)"
framework: javascriptcore
role: symbol
role_heading: Function
path: "javascriptcore/jsglobalcontextcreate(_:)"
---

# JSGlobalContextCreate(_:)

Creates a global JavaScript execution context.

## Declaration

```swift
func JSGlobalContextCreate(_ globalObjectClass: JSClassRef!) -> JSGlobalContextRef!
```

## Parameters

- `globalObjectClass`: The class to use when creating the global object. Pass NULL to use the default object class.

## Return Value

Return Value A JSGlobalContextRef with a global object of class globalObjectClass.

## Discussion

Discussion JSGlobalContextCreate(_:) allocates a global object and populates it with all the built-in JavaScript objects, such as Object, Function, String, and Array. In WebKit 4 and later, the system creates the context in a unique context group. Therefore, scripts may execute in it concurrently with scripts executing in other contexts. However, you may not use values from the context in other contexts.

## See Also

### Creating a global context

- [JSGlobalContextCreateInGroup(_:_:)](javascriptcore/jsglobalcontextcreateingroup(_:_:).md)
- [JSGlobalContextRetain(_:)](javascriptcore/jsglobalcontextretain(_:).md)
- [JSGlobalContextRelease(_:)](javascriptcore/jsglobalcontextrelease(_:).md)
