---
title: "JSGlobalContextCreateInGroup(_:_:)"
framework: javascriptcore
role: symbol
role_heading: Function
path: "javascriptcore/jsglobalcontextcreateingroup(_:_:)"
---

# JSGlobalContextCreateInGroup(_:_:)

Creates a global JavaScript execution context in the provided context group.

## Declaration

```swift
func JSGlobalContextCreateInGroup(_ group: JSContextGroupRef!, _ globalObjectClass: JSClassRef!) -> JSGlobalContextRef!
```

## Parameters

- `group`: The context group to use. The created global context retains the group. Pass NULL to create a unique group for the context.
- `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 and a context group equal to group.

## Discussion

Discussion JSGlobalContextCreateInGroup(_:_:) allocates a global object and populates it with all the built-in JavaScript objects, such as Object, Function, String, and Array.

## See Also

### Creating a global context

- [JSGlobalContextCreate(_:)](javascriptcore/jsglobalcontextcreate(_:).md)
- [JSGlobalContextRetain(_:)](javascriptcore/jsglobalcontextretain(_:).md)
- [JSGlobalContextRelease(_:)](javascriptcore/jsglobalcontextrelease(_:).md)
