Skip to content

Commit a9d224e

Browse files
Worked on 1-count.js exxplained what the = operator does and how it changes the value of variable. Also declared a variable called initials to store the first characters of each string
1 parent 15d2158 commit a9d224e

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

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

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

33
count = count + 1;
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
5+
console.log(count);
6+
// Line 3 is updating the value of the variable count by adding 1 to its current value. The = operator is used to assign the new value (which is the result of count + 1) back to the variable count. This means that after line 3 executes, count will hold a value that is one greater than it did before.
7+

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ const lastName = "Johnson";
55
// Declare a variable called initials that stores the first character of each string.
66
// This should produce the string "CKJ", but you must not write the characters C, K, or J in the code of your solution.
77

8-
const initials = ``;
8+
const initials = `${firstName[0]}${middleName[0]}${lastName[0]}`;
9+
console.log(initials); // Output: CKJ
910

1011
// https://www.google.com/search?q=get+first+character+of+string+mdn

0 commit comments

Comments
 (0)