Skip to content

Commit e262356

Browse files
committed
created dir & ext variables + logged output to console
1 parent a83775d commit e262356

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ console.log(`The base part of ${filePath} is ${base}`);
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
1919

20-
const dir = ;
21-
const ext = ;
20+
const dir = filePath.slice(0, lastSlashIndex); // Creates a variable to store the dir part of the filePath variable
21+
const ext = base.slice(base.lastIndexOf(".")); // Create a variable to store the ext part of the variable
22+
console.log(`The dir part of ${filePath} is ${dir}`); // outputs "/Users/mitch/cyf/Module-JS1/week-1/interpret"
23+
console.log(`The ext part of ${filePath} is ${ext}`); // outputs ".txt"
2224

23-
// https://www.google.com/search?q=slice+mdn
25+
// https://www.google.com/search?q=slice+mdn

0 commit comments

Comments
 (0)