Skip to content

Commit bd936fc

Browse files
Key excercises for sprint 2
1 parent d28242a commit bd936fc

4 files changed

Lines changed: 18 additions & 8 deletions

File tree

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ let count = 0;
33
count = count + 1;
44

55
// 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
6+
// Describe what line 3 is doing, in particular focus on what = reassign a variable using the = + operator.
7+
//Line 1 assigns count = 0. Line 3 uses that value (0) and adds 1, so count becomes 1.
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
const firstName = "Creola";
22
const middleName = "Katherine";
33
const lastName = "Johnson";
4-
4+
const CKJ = "something"
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 = ``;
9-
10-
// https://www.google.com/search?q=get+first+character+of+string+mdn
8+
const initials = `"${firstName.charAt(0)}${middleName.charAt(0)}${lastName.charAt(0)}"`;
9+
console.log(initials)
10+
// // https://www.google.com/search?q=get+first+character+of+string+mdn

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

Lines changed: 5 additions & 3 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 = base.slice(base.lastIndexOf("."));
2222

23-
// https://www.google.com/search?q=slice+mdn
23+
// https://www.google.com/search?q=slice+mdn
24+
console.log(`The dir part of ${filePath} is ${dir}`);
25+
console.log(`The ext part of ${filePath} is ${ext}`);

‎Sprint-2/1-key-exercises/4-random.js‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,10 @@ const num = Math.floor(Math.random() * (maximum - minimum + 1)) + minimum;
77
// Try breaking down the expression and using documentation to explain what it means
88
// It will help to think about the order in which expressions are evaluated
99
// Try logging the value of num and running the program several times to build an idea of what the program is doing
10+
11+
// In this exercise, num represent the value integer number between 1 to 100.
12+
//Math.random generates a random decimal number from 0 up to 1, but not including, 1.
13+
// down to the nearest whole number (integer).
14+
//Running the program several times generate the whole number(integer) like (1,10,15,44,66,55) several times between 1 to 100 all 100 number has a equal 1% chance to appear(generate).
15+
console . log (num)
16+
//

0 commit comments

Comments
 (0)