eval
IMPORTANT!
Starting with v24.3, this is deprecated.
Starting with v24.3, this is deprecated.
Runs JavaScript code represented as a string (evaluates expressions and executes statements). This allows you to run string contents not known in advance, such as when your code dynamically generates other code.
IMPORTANT!
As the eval function executes string contents as code, it is a potential vector for cross-site scripting.
As the eval function executes string contents as code, it is a potential vector for cross-site scripting.
Syntax
function eval(x: string): any
| Parameter | Description |
|---|---|
x
|
String containing the JavaScript code to be run. |
Return Value
Returns the result of the evaluation.
Examples
In this example, we evaluate a basic expression, and display it as a message on screen. For information on how to display notification messages, see ftos.context.response.setMessage.
var expression = '1+1+1'; message = eval(expression); ftos.context.response.setMessage(message, true);
var message = eval('Infinity + 1 > Infinity');
ftos.context.response.setMessage(message, true);