Conteúdo do Curso
Introduction to JavaScript (staging)
Introduction to JavaScript (staging)
Commenting in JavaScript
JavaScript Comments:
Comments are used to clear the code and make the program more coherent for developers. A single-line comment is used to comment out one line or a part of one line and a multi-line comment is used to comment out a block of code. In programming, comments can also be used to avoid some code lines from being executed. This is useful for testing. Multi-line comments are generally used for the formal way to represent the code
Comment vs Comment Out:
Commenting out means that you taking a part of the code and closing it with JavaScript comment symbols. they do not execute by the web browser, which means that they won’t be displayed. Check out the example of commenting out a single line below.
//const SECONDS = 60; console.log(SECONDS); const MINUTES = 60; console.log(MINUTES)
We will get the error for the variable SECONDS
because that line is commented out. But we got the desired output for the variable MINUTES
.
Single-line Comments
Single-line comments are used to comment out a part of a line or a full line of code. You can use it for explaining the code or testing the code.
let n = 50; console.log(n); // let numberOfStudents = 10; // console.log(numberOfStudents); let myAge = 25; console.log(myAge);
We only got the outputs for the variables n
and myAge
but not for numberOfStudents
because it was commented.
Tarefa
In the following given code, we do not need the wearings
variable. Your task is to comment out this variable as well as the line which displays the output for this variable.
Obrigado pelo seu feedback!
Commenting in JavaScript
JavaScript Comments:
Comments are used to clear the code and make the program more coherent for developers. A single-line comment is used to comment out one line or a part of one line and a multi-line comment is used to comment out a block of code. In programming, comments can also be used to avoid some code lines from being executed. This is useful for testing. Multi-line comments are generally used for the formal way to represent the code
Comment vs Comment Out:
Commenting out means that you taking a part of the code and closing it with JavaScript comment symbols. they do not execute by the web browser, which means that they won’t be displayed. Check out the example of commenting out a single line below.
//const SECONDS = 60; console.log(SECONDS); const MINUTES = 60; console.log(MINUTES)
We will get the error for the variable SECONDS
because that line is commented out. But we got the desired output for the variable MINUTES
.
Single-line Comments
Single-line comments are used to comment out a part of a line or a full line of code. You can use it for explaining the code or testing the code.
let n = 50; console.log(n); // let numberOfStudents = 10; // console.log(numberOfStudents); let myAge = 25; console.log(myAge);
We only got the outputs for the variables n
and myAge
but not for numberOfStudents
because it was commented.
Tarefa
In the following given code, we do not need the wearings
variable. Your task is to comment out this variable as well as the line which displays the output for this variable.
Obrigado pelo seu feedback!
Commenting in JavaScript
JavaScript Comments:
Comments are used to clear the code and make the program more coherent for developers. A single-line comment is used to comment out one line or a part of one line and a multi-line comment is used to comment out a block of code. In programming, comments can also be used to avoid some code lines from being executed. This is useful for testing. Multi-line comments are generally used for the formal way to represent the code
Comment vs Comment Out:
Commenting out means that you taking a part of the code and closing it with JavaScript comment symbols. they do not execute by the web browser, which means that they won’t be displayed. Check out the example of commenting out a single line below.
//const SECONDS = 60; console.log(SECONDS); const MINUTES = 60; console.log(MINUTES)
We will get the error for the variable SECONDS
because that line is commented out. But we got the desired output for the variable MINUTES
.
Single-line Comments
Single-line comments are used to comment out a part of a line or a full line of code. You can use it for explaining the code or testing the code.
let n = 50; console.log(n); // let numberOfStudents = 10; // console.log(numberOfStudents); let myAge = 25; console.log(myAge);
We only got the outputs for the variables n
and myAge
but not for numberOfStudents
because it was commented.
Tarefa
In the following given code, we do not need the wearings
variable. Your task is to comment out this variable as well as the line which displays the output for this variable.
Obrigado pelo seu feedback!
JavaScript Comments:
Comments are used to clear the code and make the program more coherent for developers. A single-line comment is used to comment out one line or a part of one line and a multi-line comment is used to comment out a block of code. In programming, comments can also be used to avoid some code lines from being executed. This is useful for testing. Multi-line comments are generally used for the formal way to represent the code
Comment vs Comment Out:
Commenting out means that you taking a part of the code and closing it with JavaScript comment symbols. they do not execute by the web browser, which means that they won’t be displayed. Check out the example of commenting out a single line below.
//const SECONDS = 60; console.log(SECONDS); const MINUTES = 60; console.log(MINUTES)
We will get the error for the variable SECONDS
because that line is commented out. But we got the desired output for the variable MINUTES
.
Single-line Comments
Single-line comments are used to comment out a part of a line or a full line of code. You can use it for explaining the code or testing the code.
let n = 50; console.log(n); // let numberOfStudents = 10; // console.log(numberOfStudents); let myAge = 25; console.log(myAge);
We only got the outputs for the variables n
and myAge
but not for numberOfStudents
because it was commented.
Tarefa
In the following given code, we do not need the wearings
variable. Your task is to comment out this variable as well as the line which displays the output for this variable.