---
title: "evaluateWebScript(_:)"
framework: webkit
role: symbol
role_heading: Instance Method
path: "webkit/webscriptobject/evaluatewebscript(_:)"
---

# evaluateWebScript(_:)

Returns the result of evaluating a script in the scripting environment.

## Declaration

```swift
func evaluateWebScript(_ script: String!) -> Any!
```

## Parameters

- `script`: The script to evaluate.

## Return Value

Return Value The scripting object. The format of the script is dependent on the target scripting environment. Returns WebUndefined if an exception is thrown in the JavaScript environment or there is no return value.

## See Also

### Executing scripts

- [callWebScriptMethod(_:withArguments:)](webkit/webscriptobject/callwebscriptmethod(_:witharguments:).md)
