Skip to content

Commit 9fb5c1d

Browse files
committed
Practicing charAt(), slice()
1 parent 8f3d6cf commit 9fb5c1d

File tree

4 files changed

+3411
-7
lines changed

4 files changed

+3411
-7
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@ 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+
8+
//line 3 is a statment. It is adding 1 to the value of the variable count
Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,20 @@
1+
2+
3+
// Declare a variable called initials that stores the first character of each string.
4+
// This should produce the string "CKJ", but you must not write the characters C, K, or J in the code of your solution.
5+
// https://www.google.com/search?q=get+first+character+of+string+mdn
6+
17
let firstName = "Creola";
28
let middleName = "Katherine";
39
let lastName = "Johnson";
410

5-
// Declare a variable called initials that stores the first character of each string.
6-
// This should produce the string "CKJ", but you must not write the characters C, K, or J in the code of your solution.
711

8-
let initials = ``;
912

10-
// https://www.google.com/search?q=get+first+character+of+string+mdn
13+
let initials= `${firstName.charAt(0)} ${middleName.charAt(0)} ${lastName.charAt(0)}`;
14+
//test
15+
let initialsSecond = `${firstName.charAt(3)} ${middleName.charAt(2)} ${lastName.charAt(4)}`;
16+
17+
console.log (initials, initialsSecond);
18+
19+
1120

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

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,21 @@ const lastSlashIndex = filePath.lastIndexOf("/");
1414
const base = filePath.slice(lastSlashIndex + 1);
1515
console.log(`The base part of ${filePath} is ${base}`);
1616

17+
18+
1719
// Create a variable to store the dir part of the filePath variable
20+
const dir = filePath.slice(1,5);
21+
console.log(dir);
22+
1823
// Create a variable to store the ext part of the variable
1924

20-
const dir = ;
21-
const ext = ;
2225

23-
// https://www.google.com/search?q=slice+mdn
26+
// https://www.google.com/search?q=slice+mdn
27+
28+
29+
// let fruits = ["Banana", "Orange", "Lemon", "Apple", "Mango"];
30+
31+
// let newFruits= fruits.slice(1,3);
32+
33+
// console.log(newFruits)
34+

0 commit comments

Comments
 (0)