Math calculations Last updated: 04. Jan 2023

Example of doing math calculations within JS.

Parameters

This function takes no parameters

Returns

Numbers

Example

Code example (#JS)

#JS is mixed HTML (or other text file) with inline JavaScript with # starting and ending each inline statement.
#{
    /* Simple math operations */
    write(5 + 5);
    write(" ");
    write(5 * 5);
    write(" ");
    write(5 - 3);
    write(" ");
    write(5 / 2);
    
    
    write(" ------------ ");
    
    /* More complex */
    write(((5-4) / 2) * 8);
}#

Output

The #JS code above produces the output shown below:
10 25 2 2.5 ------------ 4.0