Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Commenting in JavaScript | JavaScript syntax
Introduction to JavaScript (staging)
course content

Conteúdo do Curso

Introduction to JavaScript (staging)

Introduction to JavaScript (staging)

1. Introduction
2. JavaScript syntax
3. Data Types and Variables

bookCommenting 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.

1234
//const SECONDS = 60; console.log(SECONDS); const MINUTES = 60; console.log(MINUTES)
copy

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.

12345678
let n = 50; console.log(n); // let numberOfStudents = 10; // console.log(numberOfStudents); let myAge = 25; console.log(myAge);
copy

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.

Switch to desktopMude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo
Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

Seção 2. Capítulo 14
toggle bottom row

bookCommenting 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.

1234
//const SECONDS = 60; console.log(SECONDS); const MINUTES = 60; console.log(MINUTES)
copy

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.

12345678
let n = 50; console.log(n); // let numberOfStudents = 10; // console.log(numberOfStudents); let myAge = 25; console.log(myAge);
copy

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.

Switch to desktopMude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo
Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

Seção 2. Capítulo 14
toggle bottom row

bookCommenting 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.

1234
//const SECONDS = 60; console.log(SECONDS); const MINUTES = 60; console.log(MINUTES)
copy

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.

12345678
let n = 50; console.log(n); // let numberOfStudents = 10; // console.log(numberOfStudents); let myAge = 25; console.log(myAge);
copy

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.

Switch to desktopMude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo
Tudo estava claro?

Como podemos melhorá-lo?

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.

1234
//const SECONDS = 60; console.log(SECONDS); const MINUTES = 60; console.log(MINUTES)
copy

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.

12345678
let n = 50; console.log(n); // let numberOfStudents = 10; // console.log(numberOfStudents); let myAge = 25; console.log(myAge);
copy

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.

Switch to desktopMude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo
Seção 2. Capítulo 14
Switch to desktopMude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo
some-alt