Skip to content

Commit aed575b

Browse files
committed
fix: update exercises based on comments
1 parent 1286cf1 commit aed575b

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ console.log(`The base part of ${filePath} is ${base}`);
1818
// Create a variable to store the ext part of the variable
1919

2020
const dir = filePath.slice(1, lastSlashIndex);
21-
const ext = base.split(".")[1];
21+
const ext = base.slice(base.lastIndexOf(".") + 1);
2222

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

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ const num = Math.floor(Math.random() * (maximum - minimum + 1)) + minimum;
1111
// The num variable will evaluate to a random number between the minimum and maximum values
1212

1313
// Math.random()
14-
// Random decimal number (0 - 1)
14+
// Random decimal number [0, 1)
1515

1616
// (maximum - minimum + 1)
1717
// The size of the range
1818

1919
// Math.random() * (maximum - minimum + 1)
20-
// Random decimal (0 - 100)
20+
// Random decimal [0, 101)
2121

2222
// Math.floor(...)
23-
// Rounds the result down to a whole number (0 - 99)
23+
// Rounds the result down to a whole number [0, 100]
2424

25-
// Adding minimum shifts the range up, so the final result is between the minimum and maximum (1 - 100 inclusive)
25+
// Adding minimum shifts the range up, so the final result is between the minimum and maximum [1, 100]

Sprint-1/3-mandatory-interpret/3-to-pounds.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ const pounds = paddedPenceNumberString.substring(
1717
);
1818

1919
// 5. extracts the pence part by taking the last two digits, and pads with trailing zeroes if needed
20-
const pence = paddedPenceNumberString
21-
.substring(paddedPenceNumberString.length - 2)
22-
.padEnd(2, "0");
20+
const pence = paddedPenceNumberString.substring(
21+
paddedPenceNumberString.length - 2
22+
);
2323

2424
// 6. formats and prints the result as a pounds and pence string
2525
console.log(${pounds}.${pence}`);

0 commit comments

Comments
 (0)