Loading Please Wait...
JavaScript comments can be used to describe the working of the JavaScript code, and to make it more readable.
When testing and debugging the JavaScript code, JavaScript comments can be used to prevent the execution.
Single line comments start with //.
Any text between // and the end of the line will be ignored by JavaScript and will not be executed.
// Change heading:
document.getElementById("heading").innerHTML = "This is heading";
// Change paragraph:
document.getElementById("paragraph").innerHTML = "This is paragraph.";
let a = 10; // Declare a, give it the value of 10
let b = a + 5; // Declare b, give it the value of a + 5
Multi line comments (or Block Comments) start with /* and end with */.
Any text between /* and */ will be ignored by JavaScript.
Block comments are often used for formal documentation.
/*
The code below will change
the heading with id = "heading"
and the paragraph with id = "paragraph"
in the web page:
*/
document.getElementById("heading").innerHTML = "This is heading";
document.getElementById("paragraph").innerHTML = "This is paragraph.";
Using comments to prevent execution of code is suitable for code testing.
// document.getElementById("heading").innerHTML = "This is heading";
document.getElementById("paragraph").innerHTML = "This is paragraph.";
/*
document.getElementById("heading").innerHTML = "This is heading";
document.getElementById("paragraph").innerHTML = "This is paragraph.";
*/
How you feel about this blog:
Share this blog on:
If you find any error in the turtorials, or want to share your suggestion/feedback, feel free to send us email at: info@lynxsia.com
Contact UsWe are concern with various development process like website design & development, E-commerce development, Software development, Application development, SMS & Bulk SMS Provider, PWA Development, and many more..
Copyright ©
, Lynxsia IT Solutions, All rights reserved