Skip to content

Commit f100a1b

Browse files
committed
done updating spaces paths.js
1 parent 78ab25c commit f100a1b

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

Sprint-1/exercises/paths.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,14 @@
99

1010
// (All spaces in the "" line should be ignored. They are purely for formatting.)
1111

12+
1213
/* ================ lastIndexOf() ===================
13-
-we use this to obtain the last position of / where is located the File.txt
14-
-const base = filePath.slice(lastSlashIndex + 1); with + 1 we start to subtract after /
15-
Index: 0 1 2 ... 37 38 39 40 41 42
16-
filePath: / U s ... / f i l e .txt
17-
-
14+
15+
-we use this to obtain the last position of / where is located the File.txt
16+
-const base = filePath.slice(lastSlashIndex + 1); with + 1 we start to subtract after /
17+
Index: 0 1 2 ... 37 38 39 40 41 42
18+
filePath: / U s ... / f i l e .txt
19+
-
1820
*/
1921

2022
const filePath = "/Users/mitch/cyf/Module-JS1/week-1/interpret/file.txt";
@@ -24,6 +26,7 @@ const base = filePath.slice(lastSlashIndex + 1);
2426
console.log(base); // file.txt
2527
// console.log(`The base part of ${filePath} is ${base}`);
2628

29+
2730
// Create a variable to store the dir part of the filePath variable
2831
const lastDotIndex = filePath.lastIndexOf(".");
2932
console.log(lastDotIndex); // index position 49

0 commit comments

Comments
 (0)