This procedure can be adopted anywhere on the page. However, for better viewing and ease of maintenance, it is recommended that all logic is written in the beginning of the document, through the creation of functions to be invoked when necessary (usually linked to events).
If the logic is written from a particular event, it is not necessary to use the SCRIPT commands.
- (+) value addition and string concatenation;
- (-) minus values;
- (*) multiplication values;
- (/) values of division;
- (%) gets the remainder of a division.
Some special controls are also part of languages, they are:
- b – backspace;
- f – form feed;
- n – new line caracters;
- r – carriage return;
- t – tab characters;
- // – comment line;
- /*….*/ – delimiters to enter text with more than one line as a comment.
Finally, natural delimiters for a string are ‘or’. If necessary the use of these characters as part of the string, it uses the character preceding ‘or’.
Ex: alert (“Beware of using ‘or ‘ in a string”)