---
title: "construct(withArguments:)"
framework: javascriptcore
role: symbol
role_heading: Instance Method
path: "javascriptcore/jsvalue/construct(witharguments:)"
---

# construct(withArguments:)

Invokes the value as a JavaScript constructor.

## Declaration

```swift
func construct(withArguments arguments: [Any]!) -> JSValue!
```

## Parameters

- `arguments`: The parameters to pass to the constructor. The objects in this array must be other doc://com.apple.javascriptcore/documentation/JavaScriptCore/JSValue objects or objects that can be converted to JavaScript values using the methods listed in Creating JavaScript Values.

## Return Value

Return Value The result of calling the value as a constructor, or nil if the value cannot be treated as a JavaScript constructor.

## Discussion

Discussion Calling a constructor is equivalent to using the new keyword in JavaScript.

## See Also

### Working with Function and Constructor Values

- [call(withArguments:)](javascriptcore/jsvalue/call(witharguments:).md)
- [invokeMethod(_:withArguments:)](javascriptcore/jsvalue/invokemethod(_:witharguments:).md)
