There are 3 ways of adding JS to your web page:
The inline scripts are applied directly on HMTL elements and their principles are better explained in the HTML tutorial. However in this tutorial inline scripting, due their simplicity, will be used as well.
The external JS is by far the suggested way of scripting your web pages because it offers a complete separation between content (HTML), styling (CSS) and client side scripting (JS), and thus simplifying maintenance and upgrades of a website.
Important note regarding the scripts is that acceptance of the standards sometimes depends on a particular browser; i.e. older browsers (especially Internet explorer) have tendency not to understand certain JS standards or suggestions.
Each chapter has attached an interactive example that can be easily modified and tested as wanted.
For the purpose of simplicity many examples are written with internal scripts, instead of being imported from an external file as it is suggested.
All examples can be found at the end of the tutorial.
At the end of the tutorial you will find a complete reference list with data types, operators, statements, functions, etc...