Almost every programming language allows you to add comments to your code. Interpreter doesn’t evaluate comments, their only purpose is to give programmers opportunity to leave notes for themselves and others. There are two types of comments in JS:
Single line comments start with
//. Any text or symbols that follow, won’t be evaluated or executed.
A comment can take up the whole line:
// For Winterfell!
or can follow some code on the same line:
console.log('I am the King'); // For Lannisters!
Multiline comments start with
/* and end with
*/. Each line between them should start with the
/* * The night is dark and * full of terrors. */ console.log('I am the King');
Create a single line comment with the folowing text:
You know nothing, Jon Snow!.
Comment — “A comment is just a text and it doesn’t affect program execution. Programmers use it to add notes for themselves and for their colleagues”
// single line comment
/* * multiline comment * multiline comment */
Please sign in with your GitHub account, this is necessary to track the progress of the lessons. If you do not have an account yet, now is the time to create an account on Github.