Comments identify commands within JavaScript code. They must be placed within the <SCRIPT>...</SCRIPT> tag set to work.
Syntax
This comment
// comment
is a single-line comment where comment is any one line of text, whereas
/* comment */
is a multiple-line where comment is any amount of plain-English text.
<!-- comment
code
// comment -->
The preceding example shows the hide comment, where the comment is any (optional) text and code is JavaScript instructions. This comment hides JavaScript code from non-JavaScript browsers.
Examples
<SCRIPT LANGUAGE = "JavaScript">
<!-- This will start hiding code from non-JavaScript browsers.
//This is a comment, and will be ignored.
document.write ("Hello")
/*Here's a two line comment that will
be ignored */
document.write ("Goodbye")
// and this stops the hiding -->
</SCRIPT>

|
|
![]() |