Skip to content

Commit 68fee4f

Browse files
SamBSalgadosumn2u
authored andcommitted
Add two extra real-life examples
1 parent f51e10d commit 68fee4f

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

en/basics/comments.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,35 @@ document.getElementById("myH").innerHTML = "My First Page";
4646
document.getElementById("myP").innerHTML = "My first paragraph.";
4747
```
4848

49+
```javascript
50+
/*
51+
Temporarily disabled welcome message while testing new UI flow.
52+
*/
53+
54+
/*
55+
document.getElementById("myH").innerHTML = "Welcome back!";
56+
document.getElementById("myP").innerHTML = "We're glad to see you again.";
57+
*/
58+
```
59+
4960
They are also useful for debugging purposes:
5061

5162
```javascript
5263
let total = 0;
5364
// total = calculateTotal(items); // Temporarily disabled during testing
5465
```
5566

67+
```javascript
68+
/*
69+
Debugging logs for login issue
70+
Commented out after issue was resolved
71+
*/
72+
73+
/*
74+
console.log("User data:", user);
75+
console.log("Auth token:", token);
76+
console.log("Response from API:", response);
77+
*/
78+
```
79+
5680
Including comments in code is essential for maintaining code quality, enabling collaboration, and simplifying the debugging process. By providing context and explanations for various parts of the program, comments make it easier to understand the code in the future. Therefore, it is considered a beneficial practice to include comments in code.

0 commit comments

Comments
 (0)