Skip to content

Commit fd5b31a

Browse files
Making chang for requesting pr review again.
1 parent 1f8489e commit fd5b31a

File tree

3 files changed

+21
-17
lines changed

3 files changed

+21
-17
lines changed

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

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,12 @@ 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-
/*
20-
const slashIndex = filePath.indexOf("/");
21-
const dir =filePath.slice(slashIndex + 0, 45) ;
22-
const ext =filePath.slice(slashIndex + 49, 53);
23-
console.log(`The dir part of ${filePath} is ${dir}`);
24-
console.log(`The ext part of ${filePath} is ${ext}`);
25-
*/
19+
2620

27-
let dirDirectory = filePath.slice(filePath.indexOf("/"),filePath.lastIndexOf("/"));
28-
let extDirectory = filePath.slice(filePath.lastIndexOf("/"));
21+
let dirDirectory = filePath.slice(filePath.indexOf("/"),filePath.lastIndexOf("."));
22+
let extDirectory = filePath.slice(filePath.lastIndexOf("."));
23+
let baseDirectory = filePath.slice(filePath.lastIndexOf("/"));
2924
console.log(`The dir part of the file is ${dirDirectory}.`);
3025
console.log(`The ext part of the file is ${extDirectory}.`);
31-
26+
console.log(`The base part of the file is ${baseDirectory}.`);
3227
// https://www.google.com/search?q=slice+mdn

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

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,18 @@ console.log(num)
1010
// It will help to think about the order in which expressions are evaluated
1111
// Try logging the value of num and running the program several times to build an idea of what the program is doing
1212

13-
/*Number data type represents any type of number such as integer, float number(decimal number), infinity number, etc...
14-
In the code at line 4 the num variable are doing math function that generate a integer between variable minimum and maximum value,
15-
the floor method behind the Math are is main purpose if to help turn value of a float number and round it up to the nearest integer.
16-
inside the Math.floor parameter the math random method is choosing a random float number between 0 and 1 and have it multiply with the second expression
17-
to set the range of possible value range from 0 to under 100. The last plus one to make sure the that number stay above 0(0+1) and to 100(99+1);
13+
/*
14+
Generates a random integer within the inclusive range [minimum, maximum].
15+
16+
How the range is formed:
17+
18+
Math.random() returns a float in the interval [0, 1)
19+
20+
Multiplying by (maximum - minimum + 1) scales it to [0, maximum - minimum + 1)
21+
22+
Math.floor(...) converts that to an integer in [0, maximum - minimum]
23+
24+
Adding minimum shifts the range to [minimum, maximum]
25+
26+
The final result is always an integer between minimum and maximum, inclusive.
1827
*/

Sprint-1/2-mandatory-errors/4.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const twelveHourClockTime = "20:53";
22
const twentyFourHourClockTime = "08:53";
3-
console.log($12HourClockTime);
4-
console.log($24HourClockTime);
3+
console.log(twelveHourClockTime);
4+
console.log(twentyFourHourClockTime);
55

66
/*For this error I I fix by changing the number 12 and 24 to word variable name because in JS number can't be used to begin writing a variable name */

0 commit comments

Comments
 (0)