Tips:Using JavaScript in Memento: Difference between revisions

Jump to navigation Jump to search
m
no edit summary
mNo edit summary
mNo edit summary
Line 155: Line 155:


=== Semicolons ===
=== Semicolons ===
To make things as simple and straightforward as possible, not only is context set up for you in JavaScript fields, but the need for using JavaScript semicolons is removed.
In JavaScript, the use of semicolons is theoretically optional. In practice, however, without their use, problems arise in certain cases, and it is strongly recommended to use them to guarantee clarity and correctness.


If you know where to put semicolons, their use is recommended, to guarantee clarity and correctness. However, if you aren't sure about such things, you can omit them, and most of the time there will be no consequences. Most JavaScript fields are just one or two lines long, so the need for statement terminators is minimal.
However, if you aren't sure about such things, you can omit them, and most of the time there will be no consequences, particularly in the case of JavaScript fields, in which the requirement is only to state about expression. Most JavaScript fields are just one or two lines long, so the need for statement terminators is minimal.


Trigger scripts are straight JavaScript, so the code must obey JavaScript rules, including statement terminators.
Trigger scripts are straight JavaScript, so the code should obey strict JavaScript rules, including statement terminators.


== Links ==
== Links ==

Navigation menu