Comments
JavaScript Comments
JavaScript Comments are mainly used to describe and explain javascript code and make it more readable.
Codes after a double slash //, or between /* and */, is treated as a comment.
JavaScript Comments contains certain command or information which are not be used to be executed just used in order to describe the code.
Single Line Comments
Single Line Comments use double dashes.
Any text or code which is written between two “//”, will be ignored by JavaScript and further, this will not be executed.
The example uses a single line comment is as follows:
X=20; // Here, x is declared and assign a value of 20
Multiple-Line Comments
Multi-line comments start with /* and end with */. Here, in this multiple-line comments, we write a large amount of data which mainly contains information or data which is further not executed by javascript.
Any text, code or even comments between /* and */ will be ignored by JavaScript.
The example uses a multi-line comment is as follows:
/* Here variable x assigns a value of 20 And further variable y is calculated by adding value 5 to a variable x. */
x = 20;
y = x+5;