Skip to content

Commit f711afc

Browse files
committed
fix: improved 1-count.js comments with 'increment' term + MDN links
1 parent 8aeec63 commit f711afc

1 file changed

Lines changed: 4 additions & 6 deletions

File tree

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
let count = 0;
22

3-
count = count + 1;
3+
count = count + 1; // increment: adds 1 and assigns the new value back
44

5-
// Line 1 is a variable declaration, creating the count variable with an initial value of 0
6-
// Describe what line 3 is doing, in particular focus on what = is doing
7-
8-
// The = operator assigns a new value to 'count'. It takes the current value of 'count'.
9-
// adds 1 to it, and then stores that new value back into the 'count' variable.
5+
// MDN Increment operator: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Increment
6+
// MDN Assignment operators: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators#Assignment_operators
7+
// Alternatives: count += 1 or count++

0 commit comments

Comments
 (0)