JavaScript global method: compile

Validates the syntax of the specified JavaScript.

Syntax

compile( script, description );

Arguments

The following arguments are valid for this function:

Argument Data type Required Description
script String Yes This argument contains the name of the script you want to validate.
description String No Use this argument to store any comments you want.

Return values

RC_SUCCESS if there is no compilation error or -1 if any compilation error.

This method also returns a success or error message. It displays the following message if the JavaScript passes validation:

Successful compilation of JavaScript function or expression.

Throws

None

Description

This method validates the syntax of a JavaScript and displays a message as to the success or failure of the validation. This method is an alias of the execute() method.

Example

This example does the following:

  • Creates a variable to store a JavaScript name
  • Validates the contents of the script

This example requires the following sample data:

  • A valid JavaScript
var s = "lib.SCFILEgetTextTest"
compile( s, "Testing execute" );