JavaScript Comment
Comments in JavaScript:
1). Any text between a // and the end of the line is treated as a comment and is ignored by JavaScript
2). Any text between the characters /* and */ is treated as a comment. This may span multiple lines.
3). JavaScript also recognizes the HTML comment opening sequence <!--. JavaScript treats this as single line comment.
4). The HTML comment closing sequence --> is not recognized by JavaScript so it should be written as //-->
The following example shows how to use comments in JavaScript
<script language="javascript" type="text/javascript">
<!--
// This is a comment.
/*
* This is a multiline comment JavaScript
*/
//-->
</script>
1). Any text between a // and the end of the line is treated as a comment and is ignored by JavaScript
2). Any text between the characters /* and */ is treated as a comment. This may span multiple lines.
3). JavaScript also recognizes the HTML comment opening sequence <!--. JavaScript treats this as single line comment.
4). The HTML comment closing sequence --> is not recognized by JavaScript so it should be written as //-->
The following example shows how to use comments in JavaScript
<script language="javascript" type="text/javascript">
<!--
// This is a comment.
/*
* This is a multiline comment JavaScript
*/
//-->
</script>
Subscribe to:
Post Comments
(
Atom
)
No comments :
Post a Comment