JavaScript: Comments
Almost every programming language allows you to add comments to your code. An interpreter doesn't evaluate comments, their only purpose is to allow programmers to leave notes for themselves and others. There are two ways to write comments in JavaScript:
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 */
.
/*
The night is dark and
full of terrors.
*/
console.log('I am the King');
https://replit.com/@hexlet/helloworld
Such comments usually clarify the purpose of pieces of code.
Instructions
Create a single line comment with the following text: You know nothing, Jon Snow!
.
Definitions
Comment is a piece of text that does not affect the execution of the program. Programmers use comments to add notes for themselves or for their colleagues.
// single line comment
/* multiline comment multiline comment */