Skip to content

Commit 94e0982

Browse files
Added description for what line 3 is doing, focusing more on what = does
1 parent f2e91c5 commit 94e0982

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,15 @@ let count = 0;
22

33
count = count + 1;
44

5+
6+
//const count = 0;
7+
// count = count + 1;
8+
// console.log(count)
9+
510
// Line 1 is a variable declaration, creating the count variable with an initial value of 0
611
// Describe what line 3 is doing, in particular focus on what = is doing
12+
13+
//ANSWER:
14+
15+
// Line 3 is reassigning the value of count. This is because we are using "let" and not "const" which allows us to reassign values. The value of count is being evaluated first (count + 1), which sums up to (0 + 1 = 1) and then it is updated using the assignment operator (=), which takes the result and stores it back into the count variable.
16+

0 commit comments

Comments
 (0)