-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path0. comments.js
More file actions
19 lines (17 loc) · 812 Bytes
/
0. comments.js
File metadata and controls
19 lines (17 loc) · 812 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// All types of comments in JavaScript :
// Single-line comment using //
// Multi-line comment using /* ... */
// Documentation comment using /** ... */
// Inline comment using // at the end of a line
// Block comment using /* ... */ for multiple lines
// Commenting out code using // to disable execution
// Commenting is a way to include notes or explanations in your code without affecting its execution.
// It helps in understanding the code better and is useful for collaboration with other developers.
// Basic example of comments in JavaScript:
function calculateArea(radius) {
// area of a circle given its radius
const pi = 3.14159; // value of pi
let area = pi * radius * radius; // formula: area = π * r^2
return area; // Return the calculated area
}
console.log(calculateArea(5));