Putting Comments in Scripts.
It's always a good idea to add comments to your scripts, why? well, come months later when you decide to make changes to your script it will be easier to find the block fo code to change. I have a bad habit of not adding comments to my scripts but have found it very awkward making changes to a script. Here are two javascript examples:
Example 1 - One line comment:
<script type="text/javascript">
|
|
Example 2 - Multi line comment:
<script type="text/javascript">
|
|
For the one line comment you use // followed by your comment, this is fine for short comments, but when you need to add a much longer comment you can use example 2.
For multi line commenting you start with /* which tells Javascript to ignore everything that follows until you reach */ to close the comment. Simple enough? 
Click to the next page to learn some basics on javascript functions and variables.
| Discuss Tutorial: Introduction to JavaScript | 0 Comments |