Skip to content

Commit ac61856

Browse files
committed
Add detailed comments explaining count variable increment in 1-count.js
1 parent c984e1a commit ac61856

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

‎Sprint-2/1-key-exercises/1-count.js‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,9 @@ count = count + 1;
44

55
// Line 1 is a variable declaration, creating the count variable with an initial value of 0
66
// Describe what line 3 is doing, in particular focus on what = is doing
7-
console.log(count);
7+
console.log(count);
8+
9+
//Line 3 is reading the current value of <count>, which is <0>, and computing <count + 1>, which turns out to be 1.
10+
//It also assigns the new value <1> to the variable <count>, overwriting the initial value <0>.
11+
//The assignment operator "=" means, take the value on the right, and store it in the variable on the left.
12+
//Console.log(count) prints out the result of Line 3.

0 commit comments

Comments
 (0)