+ 1

Comments practice in Javascript

There is a practice case in js, which tells to comment one line from the code to output the right expression about JavaScript. You are given a program that prints two expressions. Task: Comment the second line of the code to print only the first expression. The thing is that comments don`t do anything, so I can`t delete the second expression with them. Of course, I can simply delete the second line and comment something instead, for example, like this: console.log("JavaScript is fun"); //I have just deleted the second expression But it doesn`t look like a valid solution. Maybe someone can explain me what is the point of this task? Thanks in advance!

22nd Jan 2022, 10:07 AM
Just_Odessa
3 Answers
+ 2
đŸ€ŁđŸ˜‚đŸ˜… Man, don't you have more deeper & existential questions?! "The thing is that comments don't do anything,..." => it is clearly put by the SoloLearn and your programmer senses that comments are not required by a machine/computer/compiler/interpreter/AI/cloud/blockchain/etc., but needed for human interactions over the code, for debugging, for timestamp changes and other mysterious things. "Maybe someone can explain me what is the point of this task?" => to get familiar with the comment syntax in JS programming language. There is a code coach with comments in almost every SL course. Why complain for 10 ez XP? Or you can win 2 duels with me in JS to make 10 XP! 😉
22nd Jan 2022, 10:20 AM
Romeo Cojocaru
Romeo Cojocaru - avatar
+ 1
If you comment the line, it will not be executed so you don't need to delete it
22nd Jan 2022, 10:20 AM
Lisa
Lisa - avatar
- 1
It just lesson how to use comments.. Code has 2 output statements. Task is to edit code to print only needed output. So commenting not required output statement will done the task. console.log("JavaScript is fun"); //console.log("JavaScript is awesome"); Also making to print only "JavaScript is fun". Not prints "JavaScript is awesome" . You don't need delete statement and write anything there.
22nd Jan 2022, 10:19 AM
Jayakrishna 🇼🇳