Skip to content

Commit 7d41310

Browse files
correct the wrong answer
1 parent 73b8e26 commit 7d41310

2 files changed

Lines changed: 6 additions & 7 deletions

File tree

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const filePath = "/Users/mitch/cyf/Module-JS1/week-1/interpret/file.txt";
1313
const lastSlashIndex = filePath.lastIndexOf("/");
1414
const base = filePath.slice(lastSlashIndex + 1);
1515
console.log(`The base part of ${filePath} is ${base}`);
16-
const dir = filePath.slice(0,`${lastSlashIndex}`-1);
16+
const dir = filePath.slice(0, `${lastSlashIndex}`);
1717
const ext = filePath.slice(filePath.lastIndexOf("."));
1818
console.log(`The dir part of ${filePath} is ${dir}`);
19-
console.log(`The ext part of this URL is ${ext}`);
19+
console.log(`The ext part of this URL is ${ext}`);
Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
const minimum = 1;
22
const maximum = 100;
3-
43
const num = Math.floor(Math.random() * (maximum - minimum + 1)) + minimum;
54
console.log(`${num}`);
65

76
//num represents a random whole number between 1 and 100,
8-
//first we calculate value inside parentheses(maximum - minimum +1) = 100 -1 + 1 =100
7+
//first we calculate value inside parentheses(maximum - minimum +1) = 100 -1 + 1 =100
98
// math.random return number between 0 and 1
10-
// math.random() * 100 give us a integer number
9+
// math.random() * 100 give us a decimal number
1110
// math.floor round down the number
12-
// add 1 to the result
13-
//for example math.floor((0.783 *100))=78 + 1 = 79
11+
// add 1 to the result
12+
//for example math.floor((0.783 *100))=78 + 1 = 79

0 commit comments

Comments
 (0)