Navigation
Poll
Would you be an active poster if Ron's Guide had a message board?


Total Votes: 62
Comments: 18 — View
Past pollsPoll idea?
Rate Ron's Guide
Rate our resource at Bigwebmaster.com
Introduction to JavaScript
This tutorial will give you an introduction to JavaScript; what it is, what it can do, and more. It also covers some basic JavaScript concepts.

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">
<!--

// this is a one line comment

//-->
</script>

Example 2 - Multi line comment:

<script type="text/javascript">
<!--

/*
this is an example of a
comment that can be added
to multiple lines.
*/

//-->
</script>

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? Smile

Click to the next page to learn some basics on javascript functions and variables.

« Previous [ 1 2 3 ] Next »
Discuss Tutorial: Introduction to JavaScript 0 Comments
There are currently no comments on this discussion.
Post a comment
Sorry, you must be a registered member to post comments.

If you would like to register, you can do so here.
If you already have an account, please login.