Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy path013-comments.js
More file actions
Latest commit
58 lines (44 loc) · 1.24 KB
/
Copy path013-comments.js
File metadata and controls
58 lines (44 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// WHAT ARE COMMENTS?
// SINGLE-LINE COMMENTS
letprice=100;
lettax=0.15;// 15% sales tax
lettotal=price+(price*tax);
console.log(total);// Output: 115
letusername="John";
// console.log(username); // Not running this right now
// MULTI-LINE COMMENTS
/* This is a
multi-line comment
that spans multiple lines */
/*
Function: calculateDiscount
Purpose: Calculates the final price after applying a discount
Parameters:
- price: original price of the item
- discount: discount percentage (0-100)
Returns: final price after discount
*/
functioncalculateDiscount(price,discount){
returnprice-(price*discount/100);
}
/*
let oldCode = "something";
let moreOldCode = "testing";
console.log("This entire block is commented out");
*/
/* This is the start
/* This won't work */
// This is the end */
// WHEN TO USE COMMENTS
// Add 5 to x
// let x = x + 5;
// Adding buffer space to prevent edge collision
// let x = x + 5;
// TODO: Optimize this loop for large datasets
// WARNING: This will fail if user is not authenticated
// HACK: Temporary fix until API v2 is released
// BEST PRACTICES
// Step 1: Get user input
// Step 2: Validate the input
// Step 3: Process the data
// Step 4: Return the result