# JavaScript Expressions

You can use JavaScript expressions in your report elements to calculate values, format text, and more.

For example, you could set a Text element to the following text to the following snippets to have the results computed when the report is rendered. The curly braces and everything inside will be replaced in the output by the computed value.

Basic math expressions:

Two times three is {2 * 3}.

Calculations using data fields:

The total for this line item is {qty * unitPrice}.

Calling static methods of String and Math built-in JavaScript objects:

The square root of nine is {Math.sqrt(9)}.

Calling built-in String prototype functions on string values from your data source:

{myDataField.toUpperCase()}

Truncate a string data value to the first three characters:

{myDataField.substring(0, 3)}