Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Impara Commenting in JavaScript. Multi-line Comments | JavaScript syntax
Introduction to JavaScript

book
Commenting in JavaScript. Multi-line Comments

Multi-line Comments
Multiline comments have a purpose same as single-line comments.
Multiline comments start with two symbols: /*. To end the comment, we use these symbols */ again. Everything in these symbols will be commented out.

/* class WebDeveloper{
constructor(firstName, lastName) {
this.firstName = firstName;
this.lastName = lastName;
}
}
let me = new WebDeveloper('Robin', 'Wieruch');
console.log(me);
*/
123456789
/* class WebDeveloper{ constructor(firstName, lastName) { this.firstName = firstName; this.lastName = lastName; } } let me = new WebDeveloper('Robin', 'Wieruch'); console.log(me); */
copy
Compito

Swipe to start coding

In the following code, we only need the fullName variable. Your task is to comment out all the variables except the fullName variable using multi-line comment.

Soluzione

/*let firstName = "William";
let lastName = "Paul";
let age = 25;
let country = 'Germany';*/

let fullName = 'William Paul';
console.log(fullName);

Summary:

  • Comments are used to illustrate the code and make the program more clear for developers.

  • Commented part is not implemented by the browser.

  • We can comment just a line of code.

  • We can comment entire block of code

Tutto è chiaro?

Come possiamo migliorarlo?

Grazie per i tuoi commenti!

Sezione 2. Capitolo 15
let firstName = "william";
let lastName = "paul";
let age = 25;
let country = 'Germany';

let fullName = 'William Paul';
console.log(fullName);

Chieda ad AI

expand
ChatGPT

Chieda pure quello che desidera o provi una delle domande suggerite per iniziare la nostra conversazione

some-alt