Monday, 16 July 2012
How to write single line comments in javascript
<!DOCTYPE html>
<html>
<body>
<h1 id="myH1"></h1>
<p id="myP"></p>
<script type="text/javascript">
// Write to a heading:
document.getElementById("myH1").innerHTML="Welcome to my Homepage";
// Write to a paragraph:
document.getElementById("myP").innerHTML="This is my first paragraph.";
</script>
<p><strong>Note:</strong> The comments are not executed.</p>
</body>
</html>
Result:
Welcome to my Homepage
This is my first paragraph.
Note: The comments are not executed.
This post was written by: Bharathi
Bharthi is a professional blogger, web designer and front end web developer. Follow him on Twitter
Subscribe to:
Post Comments (Atom)
0 Responses to “How to write single line comments in javascript”
Post a Comment