Skip to content

Commit 36a00cc

Browse files
committed
Key exercises 1-3 completed
1 parent 124ae45 commit 36a00cc

File tree

3 files changed

+8
-4
lines changed

3 files changed

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

33
count = count + 1;
4-
4+
console.log(count); // Output: 1
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+
// Line 3 is an assignment statement that updates the value of the count variable. The expression on the right-hand side (count + 1) calculates the new value by taking the current value of count (which is 0) and adding 1 to it, resulting in 1. The = operator then assigns this new value back to the count variable, effectively updating it from 0 to 1.

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ let 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-
let initials = ``;
8+
let initials = firstName.charAt(0) + middleName.charAt(0) + lastName.charAt(0); // Your code here;
9+
console.log(initials); // Output: "CKJ"//Your code to validate output here
910

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

Sprint-1/1-key-exercises/3-paths.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ console.log(`The base part of ${filePath} is ${base}`);
1717
// Create a variable to store the dir part of the filePath variable
1818
// Create a variable to store the ext part of the variable
1919

20-
const dir = ;
21-
const ext = ;
20+
const dir = filePath.slice(0, lastSlashIndex);
21+
const ext = filePath.slice(lastSlashIndex + 1).split(".").pop();
22+
console.log(`The dir part of ${filePath} is ${dir}`);
23+
console.log(`The ext part of ${filePath} is ${ext}`);
2224

2325
// https://www.google.com/search?q=slice+mdn

0 commit comments

Comments
 (0)