1. Examples of scripting in JavaScript

    Article: AN0002166Updated: 17.12.2019

    Following examples show particular possibilities of programming in ObjectGears system using JavaScript.

    For further information to JavaScript language we recommend web https://www.w3schools.com/js/default.asp.


    Text strings

    Texts are written in single or double quotations: "John Dew" or 'John Dew'.

    Escape characters

    JavaScript is using an escape character of backslash (\), which allows us to interprete special characters (e.g. simple or double quotations used to encapsulate texts) as usual characters. That will emable e.g. to use quotes or apostrophe inside texts etc. If we have inside texts the backslash character itself (e.g. when comparing domain name Domain\Username), we have to double it (in our example Domain\\Username).

    More about special signs in https://www.w3schools.com/js/js_strings.asp.


    Single line comments starts with //.


    var y = 3 // declaring y and giving it value 3

    Multi line comments begin with /* end end with */.



    This is a comment

    to the following code...


    You can use comments also to deactivate parts of your code.

    Aritmetic operators 

    Operator Description
    + Addition
    - Subtraction
    * Multiplication
    / Division
    % Modulus (Remainder)
    ++ Increment
    -- Decrement

     Comparison operators 


    Operator Description
    == equal to
    === equal value and equal type
    != not equal
    !== not equal value or not equal type
    > greater than
    >= greater than or equal to
    < less than
    <= less than or equal to
    ? ternary operator

    Logical operators 

    Operator Description
    && logical AND
    || logical OR
    ! logical NOT

    Operator for concatenating text strings

    Operator Description
    + concatenates two strings

    Example: 'John' + ' ' + 'Dew' = 'John Dew'