---
title: "callWebScriptMethod(_:withArguments:)"
framework: webkit
role: symbol
role_heading: Instance Method
path: "webkit/webscriptobject/callwebscriptmethod(_:witharguments:)"
---

# callWebScriptMethod(_:withArguments:)

Returns the result of executing a method in the scripting environment.

## Declaration

```swift
func callWebScriptMethod(_ name: String!, withArguments arguments: [Any]!) -> Any!
```

## Parameters

- `name`: The name of the method to invoke.
- `arguments`: The values to pass to the method.

## Return Value

Return Value The return value of the method. Returns WebUndefined if an exception is thrown in the JavaScript environment or the method has no return value.

## See Also

### Executing scripts

- [evaluateWebScript(_:)](webkit/webscriptobject/evaluatewebscript(_:).md)
