Skip to content

Commit 939f52f

Browse files
committed
I have completed
1 parent bc09a5b commit 939f52f

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ 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-
// line 3 is reassigning the value of the variable, = sign is used to reassign the count to initial value of 0 + the additional value of 1
7+
// line 3 is reassigning the value of the variable, = sign is used to reassign the value of count to increment by 1.

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@ console.log(`The base part of ${filePath} is ${base}`);
1616

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
19+
const secondCharacterIndex = 1;
20+
const startingPointForExtension = filePath.lastIndexOf(".");
1921

20-
const dir = ;
21-
const ext = ;
22-
23-
// https://www.google.com/search?q=slice+mdn
22+
const dir = filePath.slice(secondCharacterIndex, lastSlashIndex);
23+
const ext = filePath.slice(startingPointForExtension + 1, filePath.length);
24+
console.log(`The dir part of ${filePath} is ${dir} and the ext part is ${ext}`);
25+
// https://www.google.com/search?q=slice+mdn

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,9 @@ 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+
/*num represent any value between 1 to 100.
12+
Math.floor is a method that rounds a number down to the nearest whole number.
13+
Math.random is a method returning any number that is greater than or equal to 0 and less than 1.
14+
first of all i will try to get a value from 0 to less than 1 from Math.random and multiple it by 100
15+
and apply Math.floor to the result which will give me the integer number and then add the minimum value i.e. 1 */

0 commit comments

Comments
 (0)