JavaScript.CheckScriptSyntax
----------------------------

Checks script syntax.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [JavaScriptWebKit](component_JavaScriptWebKit.md) | [5.4](newinversion54.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "JavaScript.CheckScriptSyntax"; JavaScriptContext; Script { ; URL; startingLineNumber } ) 

**MBS**( **"JavaScript.CheckScriptSyntax";** /\* Checks script syntax. \*/  
**$JavaScriptContext**; /\* The reference number of the javascript context.e.g. $Context \*/   
**$Script**; /\* The script to evaluate. \*/   
**$URL**; /\* Optional; The source URL for this script.  
A URL for the script's source file. Used by debuggers and when reporting exceptions. This parameter is informative only: it does not change the behavior of the script. \*/   
**$startingLineNumber**) /\* Optional; An integer value specifying the script's starting line number in the file located at sourceURL. This is only used when reporting exceptions. The value is one-based, so the first line is line 1 and invalid values are clamped to 1.e.g. 1 \*/ 

### Parameters

| Parameter | Description | Example | Flags |
|---|---|---|---|
| JavaScriptContext | The reference number of the javascript context. | $Context |  |
| Script | The script to evaluate. |  |  |
| URL | The source URL for this script.   A URL for the script's source file. Used by debuggers and when reporting exceptions. This parameter is informative only: it does not change the behavior of the script. |  | Optional |
| startingLineNumber | An integer value specifying the script's starting line number in the file located at sourceURL. This is only used when reporting exceptions. The value is one-based, so the first line is line 1 and invalid values are clamped to 1. | 1 | Optional |

### Result

Returns OK or error.

### Description

Checks script syntax.  
Returns OK on success or error message.  
### Examples

Check syntax:

 Set Variable \[ $js ; Value: MBS ( "[JavaScript.New](JavaScriptNew.md)" ) \]   
Set Variable \[ $r ; Value: MBS ( "JavaScript.CheckScriptSyntax"; $js ; "test+++++" ) \]   
Show Custom Dialog \[ "Result" ; $r \]   
Set Variable \[ $r ; Value: MBS ( "[JavaScript.Release](JavaScriptRelease.md)"; $js ) \]  
### See also

- [JavaScript.New](JavaScriptNew.md)
- [JavaScript.Release](JavaScriptRelease.md)

This function checks for a license.

Created 5th November 2015 , last changed 9th February 2023

  
[JavaScript.CallFunction](JavaScriptCallFunction.md) - [JavaScript.EvaluateScript](JavaScriptEvaluateScript.md)

[HTML Version](JavaScriptCheckScriptSyntax.shtml)