Skip to content

Commit f44d3e1

Browse files
committed
declared dotIndex to save the the index of the dot.
1 parent 686ac69 commit f44d3e1

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

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

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,13 @@ const lastSlashIndex = filePath.lastIndexOf("/");
1414
const base = filePath.slice(lastSlashIndex + 1);
1515
console.log(`The base part of ${filePath} is ${base}`);
1616

17-
// Create a variable to store the dir part of the filePath variable
17+
gi
1818
// Create a variable to store the ext part of the variable
19-
const dir = filePath.slice(filePath[1],lastSlashIndex);
2019

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

0 commit comments

Comments
 (0)